---
title: ButtonDropdown
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, FigmaEmbed, TokensTable, PropsTable } from '../../src/components'
import { ButtonDropdown, Box } from '@telus-uds/components-base'
import { ButtonDropdown as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnBoth from '../../partials/_platform-considerations-both.mdx'

# ButtonDropdown

<LibraryInfo />

```jsx live
<ButtonDropdown label="ButtonDropdown" initialValue={false} />
```

## Introduction

```jsx
import { ButtonDropdown } from '@telus-uds/components-base'
```

ButtonDropdown is a wrapper for ButtonBase, which takes Button tokens but additionally has a state of `open`.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

Use in combination with other components to create an openable/expandable section.

### Accessibility

By default, `ButtonDropdown` is treated by accessibility tools as a radio button.

### Controlled ButtonDropdown

```jsx live
function ControlledDropdown() {
  const [isOpen, setIsOpen] = useState(false)
  return (
    <div>
      <ButtonDropdown
        label="Controlled ButtonDropdown"
        value={isOpen}
        selected={isOpen}
        onChange={setIsOpen}
      />
      <div>
        {isOpen && (
          <Box variant={{ background: 'light' }} space={3}>
            Hello world
          </Box>
        )}
      </div>
    </div>
  )
}
```

### Description

The `description` prop allows you to add a description to the ButtonDropdown. This can be useful for providing additional context or information about the dropdown's purpose.

```jsx live
<ButtonDropdown
  label="ButtonDropdown"
  description="This is a description for the ButtonDropdown."
/>
```

### Lead Icon

The `leadIcon` token allows you to add an icon to the start of the ButtonDropdown. This can be useful for indicating the purpose of the dropdown or for adding visual interest.

```jsx live
<ButtonDropdown
  label="ButtonDropdown"
  description="This is a description for the ButtonDropdown."
  tokens={{ leadIcon: Icons.ArrowLeft }}
/>
```

### Single Option

Use the `singleOption` prop to render the ButtonDropdown as display only without any interaction when there is only one option.

```jsx live
<ButtonDropdown label="Single Option" tokens={{ leadIcon: Icons.ArrowLeft }} singleOption={true} />
```

### Platform considerations

<AvailableOnBoth />

## Props

<PropsTable base={BaseDocs} />

## Tokens

:::warning
Note: `borderWidth` token is deprecated and will be removed in the next major release. Please consider using `borderRightWidth`, `borderLeftWidth`, `borderTopWidth`, and `borderBottomWidth` to achieve the same outcome.
:::

<TokensTable base={BaseDocs} component="ButtonDropdown" />

## Figma

<FigmaEmbed src="" />

## Variants

### Size Small

Use the `size` variant to create a smaller, more compact version of the ButtonDropdown.

```jsx live
<ButtonDropdown
  label="Size Small"
  description="This is a description for the Size Small ButtonDropdown."
  variant={{ size: 'small' }}
/>
```

### Full Width

Use the `width` variant to create a full-width version of the ButtonDropdown.

```jsx live
<ButtonDropdown
  label="Full Width"
  tokens={{ leadIcon: Icons.ArrowLeft }}
  description="This is a description for the Full Width ButtonDropdown."
  variant={{ width: 'full' }}
/>
```

## Feedback

<Feedback component="ButtonDropdown" />
