ComponentsTag Input

Tag Input

atom

Enter and remove tokens inline — labels, recipients, filters.

Topics
Tag this post so people can find it.
designfrontendopen-source
Enter or , to add

Recipe CSS

This is the exact CSS your kit ships for Tag Input — token-driven, so it re-themes with every knob. Get it (and the rest) from the configurator's Use kit panel.

/* === Tag input ===
   Multi-value input where each value is a removable chip. */
.taginput {
  display: flex;
  flex-wrap: wrap;
  gap: var(--k-s-4);
  padding: var(--k-s-4) var(--k-s-8);
  border: var(--k-bw, 1px) solid var(--k-field-border-color); border-bottom-color: var(--k-field-underline-color);
  border-radius: var(--k-field-radius);
  background: var(--k-field-bg);
  min-height: var(--k-in-h-default);
  align-items: center;
}
.taginput:focus-within { outline: 2px solid transparent; outline-offset: 2px; border-color: var(--k-ring); box-shadow: 0 0 0 var(--k-ring-w) var(--k-ring-halo); }
/* Filter-chip pattern (Linear/Vercel-style) — these are user-added
 * filter VALUES, not brand statements. Neutral surface + fg gives
 * legible contrast in both light and dark mode, where the previous
 * primary-soft + primary combo was low-contrast in dark. The hairline
 * border anchors the pill against the input's own surface. */
.taginput__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--k-s-4);
  padding: var(--k-s-2) var(--k-s-4) var(--k-s-2) var(--k-s-8);
  border-radius: 999px;
  background: var(--k-surface-2);
  color: var(--k-fg);
  border: var(--k-bw) solid var(--k-border);
  font-size: var(--k-type-eyebrow);
  font-weight: var(--k-weight-medium);
}
.taginput__remove {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: inherit;
  border-radius: 50%;
  opacity: 0.7;
}
/* Hit-target (Invariant I4) — ::before centres a --k-hit-min (24px) click area. */
.taginput__remove::before { content: ''; position: absolute; top: 50%; left: 50%; width: var(--k-hit-min); height: var(--k-hit-min); transform: translate(-50%, -50%); }
.taginput__remove:hover { opacity: 1; background: var(--k-state-hover); }
.taginput input {
  flex: 1;
  min-width: 80px;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  font-size: var(--k-type-small);
  padding: var(--k-s-2) var(--k-s-4);
}
.taginput input:focus,
.taginput input:focus-visible { outline: 0; }