A tag component with optional interactive button
npm install @telegraph/tag
Pick one:
Via CSS (preferred):
@import "@telegraph/tag"
Via Javascript:
import "@telegraph/tag/default.css"
Then, include
className="tgph"
on the farthest parent element wrapping the telegraph components
Shorthand tag component that adheres to the telegraph design system
import { Tag } from "@telegraph/tag"
...
<Tag>Tag</Tag>
Name | Type | Default | Options |
---|---|---|---|
size | string | "1" | "1" "2" |
color | string | "default" | "default", "gray", "red", "accent", "blue", "green", "yellow", "purple" |
variant | string | "soft" | "soft", "solid" |
icon | Icon Props | undefined |
|
onRemove | () => {} | undefined |
|
onCopy | () => {} | undefined |
Individual parts of the tag component that can be composed in configurations different from the default telegraph design system styles. This can be used to create modifications to one-off tag components without the need to modify the tag exported from this package.
Wraps the Tag children components and relays props to them.
import { Tag } from '@telegraph/tag'
...
<Tag.Root></Tag.Root>
Name | Type | Default | Options |
---|---|---|---|
size | string | "1" | "1" "2" |
color | string | "default" | "default", "gray", "red", "accent", "blue", "green", "yellow", "purple" |
variant | string | "soft" | "soft", "solid" |
A component built on top of the Text component from @telegraph/typography with translated props to adhere to the telegraph design system
import { Tag } from '@telegraph/tag'
...
<Tag.Text>Text</Tag.Text>
See text props
A component build on top of the Button component from @telegraph/button
import { Tag } from '@telegraph/tag'
...
<Tag.Button/>
See button props
A component built on top of the Text component from @telegraph/typography with translated props to adhere to the telegraph design system
import { Tag } from '@telegraph/tag'
...
<Tag.Text>Text</Tag.Text>
See text props
A component build on top of the Icon component from @telegraph/icon
import { Tag } from '@telegraph/tag'
...
<Tag.Icon icon={addSharp} alt="create"/>
See icon props
import { Tag } from "@telegraph/tag"
import { Lucide } from '@telegraph/icon'
<Tag.Root color="blue" variant="solid" size="2">
<Tag.Icon icon={Lucide.Add} alt="Create"/>
<Tag.Text>Text</Tag.Text>
<Tag.Button icon={{ icon: Lucide.X, alt: "remove"}} onClick={() => {}}/>
</Tag.Root>