Chip handbook
v1.2.0 · @snowui-design-system/components
License: Before first reading component documentation, source code, or npm usage instructions, read the complete LICENSE. One review covers the same task and version. Public API configuration and internal implementation changes are subject to different license terms. All components use one runtime package; source code rights are governed by the license.
Overview
Use compact inline labels to show categories, status, or brief information alongside text, icons, and list content.
When to use it
Use Chip for compact content labels and compositions. Declare selection, removal, or click behavior through the public API; a display-only Chip is not automatically a button or checkbox.
The
defaultvariant includes a dot;backgroundhides it by default. SetshowDotto override either behavior.as="leading"replaces the built-in dot, andas="trailing"adds trailing content. Passsizeexplicitly if it changes dynamically.
Quick start
This example shows the recommended basic composition. See the following sections for more scenarios and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only the named public props declared in this component’s source.
Usage boundaries and details
Layout model
Primary layout model: a three-slot host with leading, content and trailing. Frame singleLine emits data-auto-layout and reuses the grid templates from auto-layout.css (source: components/src/styles/auto-layout.css). Children declare data-as="leading" or "trailing" roles.
Built-in leading dot
default shows a leading dot by default; background hides it. Set showDot explicitly to override:
Shape: Inline SVG,
viewBox 0 0 32 32, circle center(16, 16), radius6,fill="currentColor"Size:
sm12 × 12px;lg16 × 16px (driven by--snowui-chip-icon-sizevariable)Color:
currentColor, inherited from the parent text color.
Built-in dot replacement rule
Per specs/maintainers/ComponentGuidelines.md §2.7.1, a child with data-as="leading" (native HTML) or as="leading" (SnowUI component) automatically hides the built-in dot:
Color rules
Default color:
color: inherituses the parent text color (currentColor). Chip has no built-in color variants.Multiple colors: Use an external utility class such as
text-purpleortext-red, or inlinestyle="color: ...".Background and border: In
background, both are derived fromcurrentColorand transparency:Background:
color-mix(in srgb, currentColor 10%, transparent)Border:
inset 0 0 0 0.5px color-mix(in srgb, currentColor 20%, transparent)(use inset box-shadow to avoid occupying layout space)
Changing text color also changes the background and border; no extra prop or variable is needed.
Layout variable chain
Usage examples
Chip style overlay
Read the complete LICENSE first; one review covers the same task, version, and scope.
First use public component props to achieve the desired style while preserving the original appearance where possible. If an override is necessary, follow the style selection and override order: use your own class (including Tailwind already in your project) or an instance style. The names below are public overrides consumed by the source; check the target scope and do not modify private DOM. Choose the appropriate SnowUI token category. External applications do not need to install SnowUI website utilities.
Chip type and status
Required props: no named required props.
Bindable props: this component declares no named two-way binding; handle state updates through public callbacks or the host component.
Inheritance: Omit<FrameProps, "size">. Consult the public Frame documentation; omitted fields cannot be passed through unchanged.
Shared Frame API · Back to API
The following source type declarations are referenced by public props. Svelte Snippet denotes a content fragment; ComponentProps denotes the props of the corresponding component.