Ir al contenido
Español
Acciones rápidas viene con Pro. La vista previa aparece al desbloquearlo.

Cómo funciona

The root covers its positioned container with position: absolute and inset: 0 and passes pointer events through, so it adds nothing to the layout. Opening fades in a scrim of the surface colour at 64% over a constant 10px backdrop blur (only opacity animates), turns the + by 135° into ×, and raises the actions: each starts 18px plus 10px per row lower at 55% size and transparent, and springs into place over 520ms, the nearest to the button first, 45ms apart. Hover or focus lifts a row onto a white pill with the card shadow. Closing reverses the order, farthest first, in 180ms ease-in.

Úsalo para

  • The few things people start most often from one screen: send, request, add, scan.
  • Mobile screens and compact panels where a toolbar would crowd the content.
  • Creation shortcuts in a dashboard card or a map view.

Busca otra opción cuando

  • More than five or six actions: use a menu or a page.
  • The one primary action of a page: show it as a button.
  • Actions that need explaining before they run: use a dialog.

Uso

import { QuickActions } from './QuickActions.jsx'

const actions = [
  { id: 'send', label: 'Send', icon: <SendIcon />, tone: 1 },
  { id: 'request', label: 'Request', icon: <RequestIcon />, tone: 3 },
  { id: 'topup', label: 'Top up', icon: <CardIcon />, tone: 6 },
]

export function WalletScreen({ navigate }) {
  return (
    // The container is the positioned, rounded box the scrim covers
    <section style={{ position: 'relative', overflow: 'hidden', borderRadius: 28 }}>
      <Balance />
      <RecentActivity />
      <QuickActions actions={actions} onSelect={(id) => navigate(`/wallet/${id}`)} />
    </section>
  )
}

Propiedades

PropiedadTipoPor defectoQué hace
actions{ id, label, icon, tone?, description? }[]—The actions, top to bottom. icon is a 20px element shown in a 40px square tinted with chart colour tone (1–8); description adds a second, quieter line.
onSelect(id) => void—Called with the chosen action's id; the menu then closes and focus returns to the button.
open / defaultOpen / onOpenChangeboolean / boolean / (open) => void- / false / -Controlled or uncontrolled open state, and a callback when it changes.
placement'bottom-end' | 'bottom-start''bottom-end'The corner of the container the button sits in; the actions stack above it and line up with it.
offsetnumber16Distance in px from the container's edges.
scrimbooleantrueFrost and dim the container behind while open; a press on it closes.
tone'ink' | 'accent''ink'Colour of the round button.
labelsobject—Replaces built-in text: open (button and menu name), close (button name while open). Shallow-merged over the English defaults.
...restHTMLAttributes—Other attributes go to the root <div>, which covers the container.

Accesibilidad

  • The button has aria-haspopup, aria-expanded and aria-controls, and its name switches between labels.open and labels.close.
  • The actions are a menu of menuitem buttons: opening focuses the first one, Up and Down arrows, Home and End move, Enter or Space chooses, Escape closes and returns focus to the button, Tab closes.
  • While closed the menu is hidden from screen readers and cannot be focused.
  • Icons are decorative; each action is named by its label text.
  • Rows are at least 48px tall (52px on touch screens) and the button is 52px.
  • Reduced motion fades the scrim and the actions in place without travel or stagger.

Movimiento

Open: scrim opacity 360ms ease-out; + turns 135° with a spring over 360ms; actions spring up over 520ms with a slight overshoot, nearest first, 45ms apart. Close: actions 180ms ease-in, farthest first, 22ms apart; scrim 240ms ease-in after 60ms.

Añádelo a tu proyecto

Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.

QuickActions.jsxquick-actions.csstokens.cssREADME.md

Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.

Capas
Panel inferior viene con Pro. La vista previa aparece al desbloquearlo.