Token
Token is a compact representation of an object, and is typically used to show a collection of related metadata.
Page navigation navigation
Token
React examples
Default
With a button to remove the token
Interactive
Custom size
Use consistent token sizes to maintain visual hierarchy. Avoid using multiple sizes in a single group.
With a leading visual
Issue label token
The IssueLabelToken component is used to render GitHub issue labels.
It has all of the same functionality as a Token except:
- it accepts a fillColorprop to set a color for the token
- it does not accept a leadingVisualprop
React examples
Default
Custom color
Props
Token
| Name | Default | Description | 
|---|---|---|
| leadingVisual  | React.ComponentType<React.PropsWithChildren<any>>A function that renders a component before the token text | |
| text Required | stringThe text label inside the token | |
| as  | 'span' | 'button' | 'a' | 'span' | 
| onRemove  | () => voidThe function that gets called when a user clicks the remove button, or keys  | |
| hideRemoveButton  | booleanWhether the remove button should be rendered in the token | |
| isSelected  | booleanWhether the token is selected | |
| id  | number | stringA unique identifier that can be associated with the token | |
| size  | 'small' | 'medium' | 'large' | 'xlarge'Which size the token will be rendered at | 
IssueLabelToken
| Name | Default | Description | 
|---|---|---|
| fillColor  | stringThe color that corresponds to the label | |
| text Required | stringThe text label inside the token | |
| as  | 'span' | 'button' | 'a' | 'span' | 
| onRemove  | () => voidThe function that gets called when a user clicks the remove button, or keys  | |
| hideRemoveButton  | booleanWhether the remove button should be rendered in the token | |
| isSelected  | booleanWhether the token is selected | |
| id  | number | stringA unique identifier that can be associated with the token | |
| size  | 'small' | 'medium' | 'large' | 'xlarge'Which size the token will be rendered at |