Ir al contenido

List

Cosas de un mismo tipo, una debajo de otra: un icono, un título, una segunda línea y lo que se dice o se hace al final. Si es más larga que una página, se pagina.

import { List, ListItem, ListSkeleton, ListItemSkeleton } from '@sypnia/ui/react'

En esta página
  1. 32 proyectos, 10 por página
  2. Skeleton
  3. Cuándo usarlo
  4. Para todos
  5. Props

32 proyectos, 10 por página

El estado al final, las acciones detrás de un botón, las páginas al pie.

Código
import { Badge, List, ListItem, RowActions } from '@sypnia/ui/react';

const projects = Array.from({ length: 32 }, (_, i) => ({ id: `p${i}`, name: ['storefront', 'billing', 'analytics', 'mobile-api'][i % 4] + (i > 3 ? `-${i}` : ''), tables: 3 + (i % 9), live: i % 5 !== 3 }));
// Each project with its icon, a second line, its state and its actions. 10 a page: every list longer than a page paginates.
export default function Projects() {
  return (
    <List label="Projects" pageSize={10}>
      {projects.map((p) => (
        <ListItem key={p.id} icon="folder" title={p.name} description={`${p.tables} tables`} href={`#${p.id}`}
          meta={<Badge tone={p.live ? 'ok' : 'neutral'} dot>{p.live ? 'Live' : 'Paused'}</Badge>}
          actions={<RowActions label={`Actions for ${p.name}`} actions={[{ id: 'open', label: 'Open', icon: 'arrow-right', onAction: () => {} }, { id: 'pause', label: 'Pause', icon: 'pause', onAction: () => {} }]} />} />
      ))}
    </List>
  );
}

Skeleton

La pieza real y su skeleton: la misma caja, así nada se mueve cuando llegan los datos.

  • Back officeUsed today
  • Mobile appUsed yesterday
Código
import { List, ListItem, ListSkeleton } from '@sypnia/ui/react';

export default function Skeleton() {
  return (
    <div className="sy-stack">
      <List label="Keys"><ListItem icon="key" title="Back office" description="Used today" /><ListItem icon="key" title="Mobile app" description="Used yesterday" /></List>
      <ListSkeleton items={2} />
    </div>
  );
}

Cuándo usarlo

Úsalo cuando

  • Unos pocos datos de cada cosa y una o dos acciones.
  • Cada elemento puede ser un enlace con href.

No lo uses cuando

  • Hay que comparar columna por columna: Table.
  • Cada elemento tiene una imagen y más que decir: Cards.

Para todos

  • Es una lista con nombre; un elemento enlazado es un solo enlace, y sus acciones quedan fuera del enlace.
  • En el celular las acciones van bajo el texto, de a dos.

Props

ListTipoPor defecto
labelobligatorio string
pageSize number 25
ListItemTipoPor defecto
titleobligatorio ReactNode
actions

Buttons at the end (RowActions). On phones they go below.

ReactNode
current

The item shown next to the list right now: it carries the light and `aria-current`.

boolean
description

A second line: what it is, its state.

ReactNode
href

With it the whole item is a link.

string
icon "function" | "error" | "replay" | "performance" | "uptime" | "traces" | "rage-click" | "dead-click" | "alert" | "summary" | "watch" | "sleep" | "light" | "suggestion" | "prompt" | "mcp" | "pull-request" | "git-branch" | "fix" | "check" | "open-source" | "self-host" | "sdk" | "engine" | "signals-in" | "web" | "mobile" | "backend" | "cloud" | "data" | "user" | "clock" | "shield" | "lock" | "mail" | "star" | "copy" | "arrow-right" | "arrow-up-right" | "chevron-down" | "plus" | "close" | "play" | "pause" | "search" | "info" | "warning" | "trash" | "menu" | "download" | "upload" | "filter" | "home" | "table" | "key" | "users" | "sun" | "moon" | "globe" | "sign-out" | "link" | "edit" | "calendar" | "chevron-left" | "chevron-right" | "chevron-up" | "minus" | "more" | "sort" | "arrow-left" | "arrow-up" | "arrow-down" | "arrow-down-right" | "arrow-down-left" | "arrow-up-left" | "swap" | "swap-vertical" | "chevrons-up-down" | "chevrons-left" | "chevrons-right" | "chevrons-down" | "chevrons-up" | "enter" | "undo" | "redo" | "refresh" | "expand" | "collapse" | "fullscreen" | "fullscreen-exit" | "move" | "grip" | "more-vertical" | "trend-up" | "trend-down" | "log-in" | "external" | "slash" | "equal" | "check-small" | "close-small" | "success" | "failure" | "help" | "plus-circle" | "minus-circle" | "ban" | "pending" | "dot" | "dot-off" | "bolt" | "flag" | "pin" | "bookmark" | "heart" | "thumbs-up" | "thumbs-down" | "sparkle" | "target" | "idea" | "award" | "crown" | "bell" | "bell-off" | "bug" | "fire" | "leaf" | "file" | "file-text" | "file-code" | "file-plus" | "file-check" | "file-table" | "file-lock" | "files" | "folder" | "folder-open" | "folder-plus" | "archive" | "clipboard" | "clipboard-check" | "paperclip" | "image" | "save" | "cloud-upload" | "cloud-download" | "cloud-off" | "import" | "export" | "share" | "inbox" | "send" | "box" | "layers" | "tag" | "hash" | "at" | "qr-code" | "book" | "book-open" | "notebook" | "rows" | "columns" | "grid" | "list" | "list-ordered" | "list-checks" | "kanban" | "chart-line" | "chart-bar" | "chart-area" | "chart-parts" | "chart-scatter" | "gauge" | "funnel" | "heatmap" | "sparkline" | "percent" | "sum" | "variable" | "braces" | "brackets" | "null" | "primary-key" | "relation" | "index" | "query" | "backup" | "migrate" | "seed" | "csv" | "json" | "bold" | "italic" | "underline" | "strikethrough" | "heading" | "text" | "paragraph" | "quote" | "code" | "align-left" | "align-center" | "align-right" | "indent" | "outdent" | "unlink" | "scissors" | "eraser" | "highlight" | "duplicate" | "paste" | "wand" | "palette" | "brush" | "ruler" | "crop" | "user-plus" | "user-minus" | "user-check" | "user-x" | "user-circle" | "team" | "organization" | "id-card" | "contact" | "role" | "chat" | "chats" | "comment" | "phone" | "video" | "mic" | "mic-off" | "megaphone" | "rss" | "mail-open" | "handshake" | "wave" | "desktop" | "laptop" | "tablet" | "terminal" | "window" | "browser" | "server" | "cpu" | "memory" | "disk" | "network" | "wifi" | "wifi-off" | "plug" | "power" | "container" | "queue" | "cron" | "webhook" | "api" | "route" | "load-balancer" | "dns" | "domain" | "certificate" | "firewall" | "rocket" | "deploy" | "rollback" | "logs" | "test" | "pipeline" | "commit" | "merge" | "fork" | "release" | "environment" | "region" | "robot" | "agent" | "puzzle" | "credit-card" | "wallet" | "receipt" | "invoice" | "cart" | "bag" | "coins" | "dollar" | "gift" | "plan" | "upgrade" | "usage" | "bank" | "history" | "timer" | "hourglass" | "calendar-check" | "calendar-plus" | "map" | "compass" | "translate" | "accessibility" | "keyboard" | "pointer" | "hand" | "print" | "support" | "stop" | "record" | "skip-forward" | "skip-back" | "fast-forward" | "rewind" | "volume" | "mute" | "camera" | "zoom-in" | "zoom-out" | "eye-off" | "sliders" | "settings" | "toggle" | "sidebar-left" | "sidebar-right" | "panel-bottom" | "split" | "layout" | "dashboard" | "cards" | "density" | "dark-mode" | "theme" | "mouse" | "cursor" | "select" | "picture-in-picture" | "scan" | "unlock" | "shield-off" | "shield-alert" | "shield-user" | "password" | "fingerprint" | "two-factor" | "policy" | "incognito" | "verified" | "audit" | "secret" | "p-telemetry" | "p-cases" | "p-agent" | "p-git" | "p-data" | "p-files" | "p-run" | "p-ai" | "p-mail" | "p-domains" | "p-design" | "p-learn" | "p-skills" | "p-app" | "p-ui"
loading

The item is on its way: pass the last known (or typical) title and second line; they are bars as long as them, and the picture, icon and buttons are skeletons of their own boxes.

boolean
media

Something at the start instead of an icon: an Avatar.

ReactNode
meta

At the end: a date, a count, a badge.

ReactNode
onClick

With it (and no `href`) the whole item is a button: choosing one thing of the list, as in a master–detail view.

(() => void)
ListSkeletonTipoPor defecto
description boolean true
items number 4
pagination boolean
ListItemSkeletonTipoPor defecto
description boolean true
  1. 32 proyectos, 10 por página
  2. Skeleton
  3. Cuándo usarlo
  4. Para todos
  5. Props

    Busca páginas, secciones y términos