Skip to Content
BBRICKSv0.7.4
KitPrimitives

GroupTag

The v3 mock's .gtag: a creator group's name on a lilac pill. With onOpen it is a button (the creator drawer's Groups section opens the group); otherwise plain text.

import { GroupTag } from '@ergasti/bricks';

Examples

Tags

With onOpen the tag is a button (a group a creator belongs to); without it, plain text.

Code
import { useState } from 'react';
import { GroupTag } from '@ergasti/bricks';

function Tags() {
  const [opened, setOpened] = useState('');
  return (
    <div style={{ display: 'grid', gap: 8 }}>
      <div style={{ display: 'flex', gap: 8 }}>
        <GroupTag name="Top sellers" onOpen={() => setOpened('Top sellers')} />
        <GroupTag name="TikTok first" />
      </div>
      <small>{opened ? `Opened: ${opened}` : 'Press a tag to open its group.'}</small>
    </div>
  );
}

Props

Prop

Type

Design guidance

How the BRICKS design system uses GroupTag. Written in docs/content/components/GroupTag.md; the props above are read from the code, which wins where the two disagree.

A creator group's name on a lilac pill, optionally a button that opens the group; use it to list the groups a creator belongs to.

GroupTag is the v3 mock's .gtag: 12px 700 lilac-ink text on a --lilac pill, no wrap. With onOpen it becomes a button (the creator drawer's Groups section opens that group's drawer); without it, it is plain text. dir="auto" lets an Arabic group name set its own direction.

Anatomy

  1. Pill (span.kit-gtag or button.kit-gtag): padding 5px 12px, radius 99px, inline-flex.
  2. Name: the group name.

Variants

PropLookWhen
no onOpenStatic pillRead-only lists
onOpenButton pill; hover adds a 1px inset ring in the ink colourCreator drawer › Groups

States

StateTriggerLook
Default—Lilac pill
Hoverpointer on the buttonInset ring
Focus-visibleTabShared kit focus ring
Long namelong textStays one line (nowrap); it can push the row wider
Touch≤1024pxButton grows to 36px min height

Usage

<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
  {groups.length === 0
    ? <span className="kit-muted">Not in a group</span>
    : groups.map((g) => <GroupTag key={g.id} name={g.name} onOpen={() => openGroup(g.id)} />)}
</div>
<GroupTag name="Ramadan glow squad" />

Where it appears

Guidelines

Do

  • Wrap several tags in a flex row with a small gap.
  • Use onOpen only when a group drawer exists.

Don't

  • Don't use it for statuses or tiers (use StatusPill, TierChip).
  • Don't shorten names; keep group names short at the source instead.

RTL and Arabic

  • dir="auto" per tag, so mixed-language names keep their own order.

Tokens

--lilac, --lilac-ink.

Accessibility

  • As a button: native type="button", name = the group name, Enter/Space opens.
  • As text: read inline.

Found in the source

  • Its tests cover: “with onOpen it is a button: click, Enter and Space open the group”.

Read from the component's source and tests. See Accessibility for the patterns the library follows.

See also: Avatar · AvatarStack · Button · ButtonLink

Source

src/kit/primitives/GroupTag.tsx (line 7) on GitHub.

On this page