06 · Exibição

PixelCard

8 cores · pixels piscam em quadros de 0,3s no hover/foco · seta · cor livre via --px

Card de escolha (modelo, módulo, integração) que acende uma matriz de pixels no canto superior direito, na cor do card, ao passar o mouse ou focar.

Movimento — os pixels acendem e piscam (loop)

.heex
<div class="grid grid-cols-4 gap-2.5"><.pixel_card id="pxc-01-1" href="#" color="red" icon="cart" title="Loja" description="PDV, estoque, NFC-e" loop /><.pixel_card id="pxc-01-2" href="#" color="rose" icon="smile" title="Clínica" description="Agenda e prontuário" loop /><.pixel_card id="pxc-01-3" href="#" color="green" icon="wallet" title="Financeiro" description="Contas e conciliação" loop /><.pixel_card id="pxc-01-4" href="#" color="teal" icon="trend-up" title="Receita" description="MRR e coortes" loop /></div>

color — passe o mouse em qualquer card

.heex
<div class="grid grid-cols-4 gap-2.5"><.pixel_card id="pxc-02-1" href="#" color="red" icon="cart" title="Loja" description="PDV, estoque, NFC-e" /><.pixel_card id="pxc-02-2" href="#" color="rose" icon="smile" title="Clínica" description="Agenda e prontuário" /><.pixel_card id="pxc-02-3" href="#" color="green" icon="wallet" title="Financeiro" description="Contas e conciliação" /><.pixel_card id="pxc-02-4" href="#" color="teal" icon="trend-up" title="Receita" description="MRR e coortes" /><.pixel_card id="pxc-02-5" href="#" color="blue" icon="users" title="CRM" description="Contas e pipeline" /><.pixel_card id="pxc-02-6" href="#" color="violet" icon="sparkles" title="Assistente" description="IA nos seus dados" /><.pixel_card id="pxc-02-7" href="#" color="amber" icon="calendar" title="Agenda" description="Horários e lembretes" /><.pixel_card id="pxc-02-8" href="#" color="ink" icon="code" title="API" description="Chaves e webhooks" /></div>

estado aceso (hover/foco) · arrow={false}

.heex
<div class="grid grid-cols-3 gap-2.5"><.pixel_card id="pxc-03-1" href="#" color="teal" icon="trend-up" title="Receita" description="MRR e coortes" lit /><.pixel_card id="pxc-03-2" href="#" color="violet" icon="sparkles" title="Assistente" description="IA nos seus dados" lit /><.pixel_card id="pxc-03-3" href="#" color="ink" icon="code" title="API" description="Sem seta" arrow={false} lit /></div>

Uso

<.pixel_card navigate={~p"/novo/loja"} color="red" icon="huge-shopping-cart-01" title="Loja" description="PDV, estoque, NFC-e" />
<.pixel_card title="Marca" style="--px: #f97316" />

Regras

  • Os pixels piscam em quadros (o padrão muda a cada 0,3s) e somem em direção ao centro para o texto continuar legível.
  • Sem JavaScript no produto: três máscaras de padrões trocadas por keyframe steps(1); desligado com prefers-reduced-motion.
  • Com href/navigate/patch é link; sem, é <button>. Foco de teclado faz o mesmo que o hover.
  • Grade de 3 colunas (lu-px-grid).

Referência da API

Todos os function components, atributos, valores e slots que este componente cobre.

The pixel card: a card to choose from (a model, a module, an integration) that, on hover or keyboard focus, lights up a matrix of pixels in its top right corner, in the card's colour.

<.pixel_card navigate={~p"/novo/loja"} color="red" icon="huge-shopping-cart-01"
  title="Loja" description="PDV, estoque, NFC-e" />
<.pixel_card phx-click="pick" phx-value-id="agenda" color="ink" icon="huge-calendar-03"
  title="Agenda" description="Horários e lembretes" />

With href, navigate or patch the card is a link; with none it is a <button type="button"> that takes phx-click and the other events through rest. The keyboard focus does what the hover does: the pixels, the stronger outline and the arrow (arrow={false} leaves the arrow out).

color takes a palette name (red, rose, green, teal, blue, violet, amber, ink); without it the card takes the accent. Any other colour goes through the --px custom property (style="--px: #f97316").

The pixel matrix is drawn by the LedgerUI.PixelCard hook (three random opacity patterns that swap in steps); its classes come from the server (data-lu-grid-class, data-lu-cell-class), since the stylesheet only knows the utilities written in this module. The hook needs a DOM id: pass id, or it is derived from the title. Styled only with Tailwind utilities.

<.pixel_card>

Attr Type Default Values / notes
id :string nil The hook's DOM id; derived from the title when omitted.
title (required) :string The bold name of the option.
description :string nil The muted line under the name.
icon :string nil An icon, drawn white in a round chip of the colour.
color :string nil nil, red, rose, green, teal, blue, violet, amber, ink
arrow :boolean true The arrow that appears on hover.
lit :boolean false Shows the hover/focus state (border, matrix, arrow) without the pointer.
loop :boolean false Plays the hover (border, pixels, arrow) in a loop, as the canvas demo does.
class :any nil

Any other HTML/phx attribute goes to the root element, including href, navigate, patch, method, disabled.

Slots:

  • <:inner_block> - Extra content under the description.