Token
Render an Astryx token or chip.
Astryx Props
JSON-safe Token props forwarded to Astryx.
Supported Astryx props include:
label(string; required): Text label displayed inside the token.size('sm' or 'md' or 'lg'): The size of the token.color('default' or 'red' or 'orange' or 'yellow' or 'green' or 'teal' or 'cyan' or 'blue' or 'purple' or 'pink' or 'gray'): Color variant of the token.icon(ReactNode): Optional icon rendered before the label.isDisabled(boolean): Whether the token is disabled; reduces opacity and blocks interactions.onRemove((e: React.MouseEvent) => void): Callback fired when the remove button is clicked. When provided, an X button is rendered inside the token.onClick((e: React.MouseEvent) => void): Click handler. When provided, the token renders as a <span> container with an invisible <button> inside for accessibility.href(string): Link URL. When provided, the token renders as an <a> element.description(string): Accessible description applied via aria-description on the root element.endContent(ReactNode): Content rendered after the label and before the remove button.isLabelHidden(boolean): Visually hides the label using a screen-reader-only clip technique; the label remains accessible.xstyle(StyleXStyles): StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object like style={{}}.
Props typed as React nodes, render functions, event handlers, refs, or StyleX styles are documented for Astryx parity but cannot be serialized directly from Python unless the wrapper adapts them.
See Astryx component docs: https://astryx.atmeta.com/components/Token.
Functions
constructor__init__(label, *, color='default', size=None, disabled=False, href=None, description=None, label_hidden=None, removable=False, clickable=False, action_callbacks=None, **props) -> NoneparamlabelstrVisible or accessible label for the component.
paramcolorstr= 'default'Astryx component option.
paramsizestr | None= NoneToken size.
paramdisabledbool= FalseWhether the token is disabled.
paramhrefstr | None= NoneOptional link destination.
paramdescriptionstr | None= NoneAccessible description.
paramlabel_hiddenbool | None= NoneWhether to visually hide the label.
paramremovablebool= FalseWhether to show the remove control.
paramclickablebool= FalseWhether the token acts as a button.
paramaction_callbacksIterable[Callable[[ComponentWidget, Any], None]] | None= NonePython callbacks receiving "remove" or "click".
parampropsAny= {}Returns
None