G
Tokens
TypographySpacingColorRadiusShadowMotion

TextButton

With icon


    <Arrange>
      <TextButton icon={<IconHeart />}>Like</TextButton>
      <TextButton icon={<IconPlus />}>Add</TextButton>
      <TextButton icon={<IconShare />}>Share</TextButton>
    </Arrange>
  

Icon position


    <Arrange gap="s">
      <TextButton icon={<IconArrowLeft />} iconPosition="left">TextButton</TextButton>
      <TextButton icon={<IconArrowRight />} iconPosition="right">TextButton</TextButton>
    </Arrange>
  

Without icon


    <Arrange>
      <TextButton>Like</TextButton>
      <TextButton>Add</TextButton>
      <TextButton>Share</TextButton>
    </Arrange>
  

Variant


    <Arrange>
      <TextButton variant="neutral" icon={<IconFolder />}>Move</TextButton>
      <TextButton variant="danger" icon={<IconTrash />}>Delete</TextButton>
    </Arrange>
  

Disabled


    <Arrange gap="s">
      <TextButton icon={<IconArrowLeft />} iconPosition="left" isDisabled>TextButton</TextButton>
      <TextButton icon={<IconArrowRight />} iconPosition="right">TextButton</TextButton>
    </Arrange>
  

Trim side

Use trimSide to align the TextButton content to the edge of the container.


    <Stack
      gap="m"
      borderSide="x"
      borderWidth="1px"
      borderColor="red"
      maxWidth="50ch"
      paddingY="m"
    >
      <Text>{demoText.l}</Text>
      <Arrange justifyContent="space-between">
        <TextButton trimSide="left" icon={<IconGlobe />}>TextButton</TextButton>
        <TextButton trimSide="right" icon={<IconGlobe />}>TextButton</TextButton>
      </Arrange>
    </Stack>
  

Click


    <TextButton icon={<IconPlus />} onClick={() => alert('Nice')}>Click me</TextButton>
  

With spinner

Disable the Button when it has a spinner.


    () => {
      const [hasSpinner, setHasSpinner] = React.useState(false)
      return (
        <>
          <TextButton
            icon={<IconDownload />}
            hasSpinner={hasSpinner}
            isDisabled={hasSpinner}
            onClick={() => {
              setHasSpinner(true)
              setTimeout(() => setHasSpinner(false), 2000)
            }}
          >
            Download
          </TextButton>
        </>
      )
    }
  

Props

Name
Type
Default
iconPosition
oneOf
'left' 'right'
'left'
variant
oneOf
'neutral' 'danger'
'neutral'
type
oneOf
'button' 'submit' 'reset'
'button'
children
node
icon
node
onClick
func
isDisabled
bool
trimSide
oneOf
'left' 'right' 'x'
hasSpinner
bool