Skip to content

Chip

A small pill that stands for a thing itself: a filter that is on, a tag, a choice. It can be pressed to turn on or off, or removed.

import { Chip, ChipSkeleton } from '@sypnia/ui/react'

On this page
  1. Filters that toggle
  2. Can be removed
  3. Tags
  4. Skeleton
  5. When to use it
  6. For everyone
  7. Props

Filters that toggle

Press the chips: the sentence under them follows.

Showing orders that are paid.

Code
import { useState } from 'react';
import { Chip } from '@sypnia/ui/react';

const states = ['Paid', 'Pending', 'Refunded', 'Cancelled'];
// With onClick a chip is a toggle: press to turn a filter on or off.
export default function Filters() {
  const [on, setOn] = useState(['Paid']);
  const toggle = (s: string) => setOn((v) => (v.includes(s) ? v.filter((x) => x !== s) : [...v, s]));
  return (
    <div className="sy-stack">
      <div className="sy-chips">{states.map((s) => <Chip key={s} selected={on.includes(s)} onClick={() => toggle(s)}>{s}</Chip>)}</div>
      <p className="sy-text--sm sy-text--soft">{on.length ? `Showing orders that are ${on.join(' or ').toLowerCase()}.` : 'Showing every order.'}</p>
    </div>
  );
}

Can be removed

Each chip has a small button to take it away.

status: paidregion: eutotal > 100
Code
import { useState } from 'react';
import { Button, Chip } from '@sypnia/ui/react';

const start = ['status: paid', 'region: eu', 'total > 100'];
// With onRemove a chip has a button that takes it away. Name the button after what it removes.
export default function Removable() {
  const [filters, setFilters] = useState(start);
  return (
    <div className="sy-chips">
      {filters.map((f) => <Chip key={f} icon="filter" onRemove={() => setFilters(filters.filter((x) => x !== f))} removeLabel={`Remove the filter ${f}`}>{f}</Chip>)}
      {filters.length < start.length && <Button size="sm" variant="quiet" onClick={() => setFilters(start)}>Restore filters</Button>}
    </div>
  );
}

Tags

Labels for a thing, with no action.

primary keytextnumberunique
Code
import { Chip } from '@sypnia/ui/react';

// Without handlers a chip is a label for a thing: a tag, a type.
export default function Static() {
  return (
    <div className="sy-chips">
      <Chip icon="key">primary key</Chip>
      <Chip>text</Chip>
      <Chip>number</Chip>
      <Chip selected>unique</Chip>
    </div>
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

ColombiaMexico
Code
import { Chip, ChipSkeleton } from '@sypnia/ui/react';

// Chips whose words are still loading. The skeleton has the same box as the real one, so nothing moves when the data arrives.
export default function Skeleton() {
  return (
    <div className="sy-row">
      <Chip>Colombia</Chip><Chip>Mexico</Chip>
      <ChipSkeleton /><ChipSkeleton />
    </div>
  );
}

When to use it

Use it when

  • Filters above a list: press to turn each one on or off (onClick).
  • Values the person added and can take away: active filters, tags (onRemove).
  • Tags that describe a thing, with no action.

Do not use it when

  • It shows the state of a thing: Badge.
  • Exactly one of a few options must be chosen: SegmentedControl or Radio.
  • It starts an action («Export»): that is a Button.

For everyone

  • With onClick it is a toggle button: Enter and Space press it, and it says whether it is pressed.
  • With onRemove it has a button of its own; name it after what it removes with removeLabel («Remove the filter status: paid»).
  • The selected state has a lit border and background besides the announced state.
  • On phones a row of chips wraps onto more lines; it never scrolls sideways.

Props

ChipTypeDefault
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"
onClick (() => void)
onRemove (() => void)
removeLabel string
selected boolean
  1. Filters that toggle
  2. Can be removed
  3. Tags
  4. Skeleton
  5. When to use it
  6. For everyone
  7. Props

    Search pages, sections and terms