Tag
Tags present static metadata or contextual information. They provide a fixed visual treatment, making them ideal for displaying system-defined values, attributes, or informational labels.
import {Tag} from "@qualcomm-ui/react/tag"Examples
Icons
Icons are supplied using the startIcon and endIcon props.
<Tag emphasis="neutral" startIcon={Plus}>
Label
</Tag>
<Tag emphasis="neutral" endIcon={Plus}>
Label
</Tag>
Variants
Choose from three variants: link, selectable and dismissable.
<Tag endIcon={Link2} variant="link">
link
</Tag>
<Tag variant="selectable">selectable</Tag>
<Tag variant="dismissable">dismissable</Tag>
Controlled State
Set the initial value using the defaultSelected prop, or use selected and onSelectedChange to control the value manually. These props follow our controlled state pattern. Only applicable when variant is selectable.
import {type ReactElement, useState} from "react"
import {Check, Plus, Star} from "lucide-react"
import {Tag} from "@qualcomm-ui/react/tag"
export function TagControlledDemo(): ReactElement {
const [selected, setSelected] = useState<boolean>(false)
return (
<div className="flex flex-col items-start gap-2">
<Tag
endIcon={<Star />}
onSelectedChange={setSelected}
selected={selected}
size="lg"
startIcon={selected ? Check : Plus}
variant="selectable"
>
{selected ? "Subscribed" : "Subscribe"}
</Tag>
</div>
)
}Colors
Control the visual emphasis with different colors via the emphasis prop.
<Tag emphasis="outline-brand" startIcon={Smile} variant="selectable">
outline-brand
</Tag>
<Tag emphasis="outline-neutral" startIcon={Smile} variant="selectable">
outline-neutral
</Tag>
<Tag emphasis="neutral" startIcon={Smile} variant="selectable">
neutral
</Tag>
<Tag emphasis="blue" startIcon={Smile} variant="selectable">
blue
</Tag>
<Tag emphasis="cyan" startIcon={Smile} variant="selectable">
cyan
</Tag>
<Tag emphasis="teal" startIcon={Smile} variant="selectable">
teal
</Tag>
<Tag emphasis="lime" startIcon={Smile} variant="selectable">
lime
</Tag>
<Tag emphasis="green" startIcon={Smile} variant="selectable">
green
</Tag>
<Tag emphasis="yellow" startIcon={Smile} variant="selectable">
yellow
</Tag>
<Tag emphasis="amber" startIcon={Smile} variant="selectable">
amber
</Tag>
<Tag emphasis="orange" startIcon={Smile} variant="selectable">
orange
</Tag>
<Tag emphasis="red" startIcon={Smile} variant="selectable">
red
</Tag>
<Tag emphasis="magenta" startIcon={Smile} variant="selectable">
magenta
</Tag>
<Tag emphasis="violet" startIcon={Smile} variant="selectable">
violet
</Tag>
<Tag emphasis="purple" startIcon={Smile} variant="selectable">
purple
</Tag>
Sizes
Choose from three sizes: sm, md and lg. The default size is md.
<Tag size="sm" variant="dismissable">
Label
</Tag>
<Tag size="md" variant="dismissable">
Label
</Tag>
<Tag size="lg" variant="dismissable">
Label
</Tag>
States
Disable the tag by setting the disabled prop.
<Tag variant="dismissable">Label</Tag>
<Tag disabled variant="dismissable">
Label
</Tag>
Shape
Control the shape of the tag with the shape prop. The default shape is square.
<Tag shape="square">Label</Tag>
<Tag shape="rounded">Label</Tag>
API
<Tag>
booleantrue, the component becomes
unresponsive to input and is visually dimmed to indicate its disabled state.| 'outline-brand'
| 'outline-neutral'
| 'neutral'
| 'amber'
| 'blue'
| 'cyan'
| 'green'
| 'lime'
| 'magenta'
| 'orange'
| 'purple'
| 'red'
| 'teal'
| 'violet'
| 'yellow'
| 'kiwi'
| LucideIcon
| ReactNode
ReactElement for additional
customization.
Ignored when variant is dismissable, as it is reserved for the
dismiss icon.() => void
dismissable.(
selected: boolean,
) => void
selectable.| ReactElement
| ((
props: object,
) => ReactElement)
booleanselectable.| 'square'
| 'rounded'
| 'sm'
| 'md'
| 'lg'
| LucideIcon
| ReactNode
ReactElement for additional
customization.| 'link'
| 'selectable'
| 'dismissable'
className'qui-tag__root'data-disableddata-emphasis| 'outline-brand'
| 'outline-neutral'
| 'neutral'
| 'amber'
| 'blue'
| 'cyan'
| 'green'
| 'lime'
| 'magenta'
| 'orange'
| 'purple'
| 'red'
| 'teal'
| 'violet'
| 'yellow'
| 'kiwi'
data-shape| 'square'
| 'rounded'
data-size| 'sm'
| 'md'
| 'lg'
data-tag-part'root'data-variant| 'link'
| 'selectable'
| 'dismissable'
StartIcon
className'qui-tag__icon'data-tag-part'start-icon'EndIcon
Note that the endIcon prop is ignored when variant is dismissible.
className'qui-tag__icon'data-tag-part'end-icon'