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