06 · Display

PixelCard

8 colors · pixels blink in 0.3s frames on hover/focus · arrow · free color via --px

A choice card (model, module, integration) that lights up a pixel matrix in the top-right corner, in the card color, on hover or focus.

Motion — the pixels light up and blink (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 — hover over any 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>

lit state (hover/focus) · 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>

Usage

<.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" />

Rules

  • The pixels blink in frames (the pattern changes every 0.3s) and fade toward the center so the text stays readable.
  • No JavaScript in the product: three pattern masks swapped by a steps(1) keyframe; turned off with prefers-reduced-motion.
  • With href/navigate/patch it is a link; without, a <button>. Keyboard focus does the same as hover.
  • A 3-column grid (lu-px-grid).

API reference

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.