Usage

import { Button } from '@loomhq/lens'
<Button>Button</Button>

Sizes

  • medium is the default size and should cover most of the cases.
  • Use large size in special cases to highlight the button.
  • Use small in tight spaces.

Variants

  • neutral is the default variant and should cover most of the cases.
  • Use the primary variant to highlight the most important action.
  • Use the record variant to indicate a recording action.
  • Use the upgrade variant to indicate a plan upgrade action.
  • Use the danger variant to indicate a destructive action.
  • Use the ai variant for actions related to Loom AI.

With icon

See the Icon set.

One icon

Two icons

When using two icons, reserve iconAfter for icons that provide a clear affordance for the user when selecting on the button. Arrows and chevrons are best reserved for iconAfter.

For buttons with logo, use the variant neutral.

Floating

For buttons floating over content, use isFloating. For the neutral variant, it uses solid backgrounds

With loader

Full width

Disabled

Aria disabled

For buttons whose disabled state is relevant to assistive technologies such as screen readers, use the ariaDisabled prop. The ariaDisabled prop will only be applied when the disabled prop is true.

By default, ariaDisabled is unset, excluding disabled buttons from the DOM. Users relying on assistive technologies will not be notified of the button's existence.

The ariaDisabled prop should be set to true when the disabled semantics should be conveyed. Best practice is to use ariaDisabled when a button is disabled in a field due to missing entries or when an upgrade is needed to access a feature.

RefHandler

Use the refHandler prop to pass down a function that creates/sets your ref from Button's parent component.

HTML tag

Change the HTML wrapper tag with htmlTag prop. Use the download prop to indicate that the linked resource is intended to be downloaded rather than displayed in the browser. For download links, best practice is to specify the title, type and size of the file explicitly or in aria-label.

UFO Press Tracing

Like the Atlaskit Button component, if you use the interactionName prop, then the button will start tracing a press event within UFO when it is clicked. More about press tracing

Props

name
type
default
size
'small' | 'medium' | 'large'
'medium'
variant
| 'neutral' | 'primary' | 'secondary' | 'record' | 'upgrade' | 'danger' | 'ai'
'neutral'
iconPosition
'left' | 'right'
'left'
htmlTag
'button' | 'a'
'button'
children
React.ReactNode
isDisabled
boolean
ariaDisabled
boolean
hasFullWidth
boolean
icon
React.ReactNode
iconBefore
React.ReactNode
iconAfter
React.ReactNode
logoSrc
string
onClick
React.MouseEventHandler<HTMLButtonElement>
hasLoader
boolean
isFloating
boolean
href
string
download
string
target
string
type
string
refHandler
(ref: HTMLButtonElement) => void
interactionName
string
className
string
style
any