Skip to content

OChip ​

OChip presents compact categorized content with optional icon and removal action, or a monospace overline label for section headers and metadata.

Usage ​

Step by step ​

  1. Import OChip from the ooko-ui/chip public subpath.
  2. Place the primary value in the default slot and optional secondary content, such as a counter, in the dual slot. Add overline for a section or metadata label.
  3. When the chip is removable, add close, give the button a contextual closeLabel, and update the parent collection on close.

Example ​

The rendered example and its source come from the same Vue single-file component.

Design 12

Interactive playground ​

Change the label, color, size, outline, overline, and close action. The preview updates immediately.

Example label 12

Props ​

PropTypeDefaultDescription
color"primary" | "secondary" | "info" | "success" | "warning" | "danger" | "neutral""primary"Visual color applied to the chip.
sizeOokoFormControlSize"md"Controls the chip's scale.
outlinebooleanfalseUses the outlined chip treatment.
overlinebooleanfalseUses the compact monospace, uppercase overline treatment for section headers and metadata labels.
counterbooleanfalseUses the round, discreet counter treatment for a number shown beside a title.
closebooleanfalseDisplays a button that emits the close event.
closeLabelstring"Remove chip"Accessible name of the close button.
iconComponentundefinedVue component rendered as the chip icon.
iconPositionOChipIconPosition"leading"Places the icon before or after the chip content.

Events ​

EventPayloadDescription
closenoneRequests removal of the chip.

Slots ​

SlotPropsDescription
defaultnoneProvides the visible chip content.
dualnoneProvides content for the secondary segment, such as a counter.
iconnoneProvides configured or custom icon markup and overrides the icon prop.
TypeDefinition
OChipIconPositiontype OChipIconPosition = "leading" | "trailing";
OChipSizetype OChipSize = OokoFormControlSize;
OokoFormControlSizetype OokoFormControlSize = "sm" | "md";
OokoColortype OokoColor = (typeof OOKO_COLORS)[number];

CSS custom properties ​

Custom propertyDefaultDescription
--o-chip-paddingvar(--o-space-0) var(--o-space-2)Sets the inner spacing around the chip content.
--o-chip-border-radiusvar(--o-radius-round)Sets the chip corner radius.
--o-chip-gapvar(--o-space-1-5)Sets the space between chip elements.
--o-chip-icon-size1remSets the rendered leading or trailing icon size.
--o-chip-close-size1remSets the close button background area.
--o-chip-close-icon-size0.75remSets the close icon size to approximately the text size.
--o-chip-focus-width0.125remSets the close button focus outline width.
--o-chip-focus-stylesolidSets the close button focus outline style.
--o-chip-focus-offset0.0625remSets the distance between the close button and its focus outline.
--o-chip-font-sizemax(var(--o-font-size-xs), var(--o-font-size-min))Sets the chip label size, never below the --o-font-size-min legibility floor by default.
--o-chip-overline-font-sizemax(0.6875rem, var(--o-font-size-min))Sets the overline label size; monospace capitals read larger, so it sits at the legibility floor by default.

Override example ​

css
:root {
  --o-chip-border-radius: var(--o-radius-control);
}

Accessibility ​

  • The chip itself is non-interactive inline content and does not add an unnecessary ARIA role.
  • Icons are decorative and hidden from assistive technologies.
  • When close is enabled, the component renders a native button with its accessible name supplied by closeLabel.
  • The close button preserves native pointer, keyboard, and focus behavior and has a visible :focus-visible outline.
  • Native attributes are forwarded to the root span.

Behavior and edge cases ​

  • Activating the close button emits close; visibility remains controlled by the parent.
  • The close button has equal visual spacing from the top, bottom, and inline end in both sizes.
  • The icon prop accepts any Vue icon component, while the icon slot overrides it.
  • iconPosition has no visual effect when neither the icon prop nor the icon slot is provided.
  • The dual slot creates a second segment using the current theme's default surface and text colors.
  • overline renders a transparent chip with a thin colored border, compact corners, and uppercase monospace text with widened letter-spacing. Put an index in the default slot with the label (for example S.02 Work) and a counter in the dual slot, which then becomes a segment filled with the chip color and white text, separated from the label by the border. overline takes precedence over outline.
  • Uppercase is visual only (text-transform), so assistive technologies read the slot text as written.
  • counter renders a round, discreet pill with a tinted background and tabular digits, for a number shown beside a title, such as the number of items in a group. Give the number context in the surrounding text or an aria-label, since a bare number is ambiguous.
  • The overline font comes from the --o-font-family-mono semantic token.
  • A leading icon remains at the far left. A trailing icon moves to the end of the dual segment when present.
  • When both a trailing icon and the close button are present, the close button remains the final control.
  • md is 1.5rem (24 px at the default root size) and sm is 1.125rem (18 px). Both can grow with enlarged or wrapping content.
  • App defaults may configure color, size, outline, closeLabel, and iconPosition; direct props take precedence.