Tag

An interactive tag, link or filter.

checked shows selection; href turns the tag into a link.

Live example

Example controls

Usage

'use client';

import { Tag } from '@prosazhin/pbcomponents';
import { useState } from 'react';

function Example() {
  const [checked, setChecked] = useState(false);
  return (
    <Tag
      checked={checked}
      onClick={() => setChecked(!checked)}
    >
      Tag
    </Tag>
  );
}

Component API

PropType / variantsPurposeDefault
childrenstringComponent content.—
size's' | 'm's · mComponent size.m
theme'light' | 'border'light · borderTag appearance.light
checkedbooleanCurrent selected state.false
disabledbooleanDisables interaction.false
loadingbooleanShows a pending action.false
leftIconSvgTypenone · check · search · userIcon before the text; accepts an SVG component.—
rightIconSvgTypenone · check · search · userIcon after the text; accepts an SVG component.—
leftIconClassNamestringClass of the left icon.—
rightIconClassNamestringClass of the right icon.—
onClick(event) => voidTag selection handler.—
hrefstringRenders a link instead of a button.—
linkComponentElementTypeCustom link component, such as Next.js Link.—
target'_self' | '_blank'_self · _blankWhere to open the link._self
type'button' | 'reset' | 'submit'button · reset · submitHTML button type.button
classNamestringClass of the root element.—
textClassNamestringClass of the text part.—

Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.