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
| Prop | Type / variants | Purpose | Default |
|---|---|---|---|
children | string | Component content. | — |
size | 's' | 'm's · m | Component size. | m |
theme | 'light' | 'border'light · border | Tag appearance. | light |
checked | boolean | Current selected state. | false |
disabled | boolean | Disables interaction. | false |
loading | boolean | Shows a pending action. | false |
leftIcon | SvgTypenone · check · search · user | Icon before the text; accepts an SVG component. | — |
rightIcon | SvgTypenone · check · search · user | Icon after the text; accepts an SVG component. | — |
leftIconClassName | string | Class of the left icon. | — |
rightIconClassName | string | Class of the right icon. | — |
onClick | (event) => void | Tag selection handler. | — |
href | string | Renders a link instead of a button. | — |
linkComponent | ElementType | Custom link component, such as Next.js Link. | — |
target | '_self' | '_blank'_self · _blank | Where to open the link. | _self |
type | 'button' | 'reset' | 'submit'button · reset · submit | HTML button type. | button |
className | string | Class of the root element. | — |
textClassName | string | Class of the text part. | — |
Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.