import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import { ButtonBase } from './button-base';
### This is a base component. It should not be used in your feature code directly but as a "base" for other UI components
# ButtonBase
The `ButtonBase` is the base component for buttons.
## Props
The `ButtonBase` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props
### Size
Use the `size` prop and the `Size` object from `./ui/helpers/constants/design-system.js`
to change the size of `ButtonBase`. Defaults to `Size.MD`
Optional: `BUTTON_BASE_SIZES` from `./button-base` object can be used instead of `Size`.
Possible sizes include:
- `Size.SM` 32px
- `Size.MD` 40px
- `Size.LG` 48px
```jsx
import { Size } from '../../../helpers/constants/design-system';
import { ButtonBase } from '../../component-library';
```
### Block
Use boolean `block` prop to quickly enable a full width block button
```jsx
import { DISPLAY } from '../../../helpers/constants/design-system';
import { ButtonBase } from '../../component-library';
Default Button
Block Button
```
### As
Use the `as` box prop to change the element of `ButtonBase`. Defaults to `button`.
When an `href` prop is passed it will change the element to an anchor(`a`) tag.
Button `as` options:
- `button`
- `a`
```jsx
import { ButtonBase } from '../../component-library';
Button Element
Anchor Element
```
### Href
When an `href` prop is passed it will change the element to an anchor(`a`) tag.
```jsx
import { ButtonBase } from '../../component-library';
Anchor Element;
```
### External link
When an `externalLink` prop is passed it will change the element to an anchor(`a`) tag and add the `target="_blank"` and `rel="noopener noreferrer"` attributes.
```jsx
import { ButtonBase } from '../../component-library';
Anchor element with external link
;
```
### Disabled
Use the boolean `disabled` prop to disable button
```jsx
import { ButtonBase } from '../../component-library';
Disabled Button;
```
### Loading
Use the boolean `loading` prop to set loading spinner
```jsx
import { ButtonBase } from '../../component-library';
Loading Button;
```
### Icon Name
Use the `startIconName` and/or `endIconName` prop with the `IconName` enum from `./ui/components/component-library` to select icon.
```jsx
import { ButtonBase } from '../../component-library';
import { IconName } from '../icon';
Button;
```
```jsx
import { ButtonBase } from '../../component-library';
import { IconName } from '../icon';
Button;
```
### RTL
For RTL language support use the `textDirection` prop.
```jsx
import { ButtonBase, IconName, TextDirection } from '../../component-library';
<>
Button Demo
Button Demo
>;
```
### Ellipsis
Use the boolean `ellipsis` prop to change the if the `ButtonBase` component to have an ellipsis.
Note: this should only be used for dynamic/user generated content or addresses. Generally, button text should be succinct and only contain one or two words.
```jsx
import { ButtonBase } from '../../component-library';
This is long text example without ellipsis
This is long text example with ellipsis
;
```