---
title: ExpandCollapseMini
---

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

# ExpandCollapseMini

<LibraryInfo figmaLink="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2F4zJn2Qn6uXOqPP1GVDipy6%2F%25F0%259F%258D%2580-Allium-Components%3Fnode-id%3D3665%253A42207" />

```jsx live
<ExpandCollapseMini expandTitle="Hide price breakdown" collapseTitle="See price breakdown">
  <Typography>Some content.</Typography>
</ExpandCollapseMini>
```

## Introduction

Similar to [ExpandCollapse](expand-collapse). Clicking on the hyperlink triggers target content to display in a panel directly below CTA.

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

## Guidance

- Use ExpandCollapseMini to show/hide visually hidden content
  - Show hidden content directly below or adjacent to the ExpandCollapseMini
  - Show more information to provide clarity to information a user may interpret as unclear
- Use sentence case
- Text should be lead by a strong action word
- Text should be as short as possible

### Open on initial load

The component's panel won't open when loaded by default. If the `initialOpen` prop is set to `true`, the panel will be opened and content will be visible.

```jsx live
<ExpandCollapseMini
  initialOpen={true}
  expandTitle="Hide price breakdown"
  collapseTitle="See price breakdown"
>
  <Typography>Visible content by default.</Typography>
</ExpandCollapseMini>
```

### Ref forwarding

Note that `ExpandCollapseMini` provides ref forwarding, which allows you, for
example, to move focus to it manually (try clicking the button and then press
the spacebar to expand / collapse):

```jsx live
function expandCollapseMiniFocusExample() {
  const expandCollapseMiniRef = useRef()
  const handlePress = () => {
    expandCollapseMiniRef.current.focus()
  }

  return (
    <>
      <Button onPress={handlePress}>Focus</Button>
      <ExpandCollapseMini
        expandTitle="Hide price breakdown"
        collapseTitle="See price breakdown"
        ref={expandCollapseMiniRef}
      >
        <Typography>Some content.</Typography>
      </ExpandCollapseMini>
    </>
  )
}
```

### Accessibility

:::info
Limit the use of compact as it may the accessibility for users
:::

Use the React Native `accessibilityLabel` attribute to provide an accessibility label to the toggle control.

### Platform considerations

<AvailableOnBoth />

## Props

<PropsTable web={WebDocs} />

## Tokens

<TokensTable web={WebDocs} component="ExpandCollapseMini" />

### Use of `dataSet`

Use `dataSet` prop to pass custom data attributes. Here's an example:

```jsx live
<ExpandCollapseMini
  expandTitle="Hide price breakdown"
  collapseTitle="See price breakdown"
  dataSet={{ 'field-id': 'test field id', 'entry-id': 'test entry id' }}
>
  <Typography>Some content.</Typography>
</ExpandCollapseMini>
```

## Variants

ExpandCollapseMini's variants are the same as for [Link](Link#variants).

### Icon position

Default is right, can be controlled with the `iconPosition attribute`.

```jsx live
<ExpandCollapseMini
  iconPosition="left"
  expandTitle="Hide price breakdown"
  collapseTitle="See price breakdown"
>
  <Typography>Some content.</Typography>
</ExpandCollapseMini>
```

### Size

Size can be any of `micro`, `small`, `medium`, `large` (the sizes supported by the TextButton/Link components). Pass a variant with the desired size.

```jsx live
function ExpandCollapseMiniSizes() {
  return ['micro', 'small', 'medium', 'large'].map((size) => (
    <ExpandCollapseMini
      collapseTitle="See price breakdown"
      expandTitle="Hide price breakdown"
      key={size}
      variant={{ size }}
    >
      <Typography>Some content.</Typography>
    </ExpandCollapseMini>
  ))
}
```

### Alternative

```jsx live
<ExpandCollapseMini
  variant={{ alternative: true }}
  expandTitle="Hide price breakdown"
  collapseTitle="See price breakdown"
>
  <Typography>Some content.</Typography>
</ExpandCollapseMini>
```

### Inverse

```jsx live dark
<Box variant={{ background: 'darkest' }} space={1}>
  <ExpandCollapseMini
    variant={{ inverse: true }}
    expandTitle="Hide price breakdown"
    collapseTitle="See price breakdown"
  >
    <Typography variant={{ inverse: true }}>Some content.</Typography>
  </ExpandCollapseMini>
</Box>
```

### Quiet

`quiet` variant minimize visual attention by removing the underline border.

```jsx live
<StackView space={3}>
  <ExpandCollapseMini
    variant={{ quiet: true }}
    expandTitle="Hide price breakdown"
    collapseTitle="See price breakdown"
  >
    <Typography>Quiet content.</Typography>
  </ExpandCollapseMini>
</StackView>
```

### Open on initial load

`false` by default, if the `initialOpen` prop is set to `true`, panel will be opened and content will be visible by default.

```jsx live
<ExpandCollapseMini
  initialOpen={true}
  expandTitle="Hide price breakdown"
  collapseTitle="See price breakdown"
>
  <Typography>Visible content by default.</Typography>
</ExpandCollapseMini>
```

## Feedback

<Feedback component="ExpandCollapseMini" />
