Usage

Button comes with solid, outline, outline-filled, raised, and link variants. Use the variant prop to change the appearance of the button.

import { Button } from '@houzz/ui';

Size

Use the size prop to select from available size variants.

Color

Using houzz-ui's semantic color names, you can apply a subset of colorVariant to any variant. The values available for Button are accent, neutral, danger, and autoMate.

Button with Icon

An Icon can render to the left or right of the Button text.

Button states

Button's can be disabled or loading

Buttons as anchor

Passing a href prop will make the button be rendered as an <a> tag.

Icon Buttons

Helper to render round buttons and optional (recommended) tooltip

Buttons on dark background

Often times, sections on pages can have a dark background. We have not built a inverse colorVariant into Button yet. For the time being, use <InverseButton/>. InverseButton only has one colorVariant (neutral) and 2 variants (outline and link)

Pill Button

Set shape="pill" to get rounded / pill / bubble shaped buttons

Custom styles with psuedo props

In certain situations, the available variants will not suffice. Button styles can be overridden using houzz-ui system and psuedo props:

  • _active
  • _hover
  • _focus

Note: It is important to provide all 3 to have proper focus/active styling. Otherwise, you may observe odd side effects from the existing specificty defined in the default Button component. This focus state for outline and raised variants can get messy. Please review with design to make sure color contrast makes sense and "on brand"

Props

Button
System Props

  • COMMON
  • TYPOGRAPHY
  • BORDER
  • LAYOUT
  • POSITION
  • FLEX
  • GRID
  • Learn More
NameTypeDescription
size"small" | "medium" | "large"Button size. Default to medium.
medium
gradientResponsiveValue<ReactText, Required<Theme<ReactText>>>-
iconBtnSize"small" | "medium" | "large"-
shape"default" | "pill"The shape of the button
default
$colorVariant"accent" | "neutral" | "danger" | "autoMate"-
colorVariant"accent" | "neutral" | "danger" | "autoMate"Color from semantic color list
accent
variant"link" | "solid" | "outline" | "outline-filled" | "raised"Predefined button style. Default to primary.
href ? 'link' : 'solid'
iconReactNodeIcon name or component.
$iconAlign"end" | "start"-
isActivebooleanFor "pressed" state. Will take :hover styles. Can be used for showing a menu button or button within ButtonGroup is active
false
isBlockbooleanIs block button or not. Default to be inline-block button.
false
isDisabledbooleanIs button disabled or not.
false
isLoadingbooleanIf true, will display a loading state and disable button.
false
hrefstringIf href is passed in, will render as an <a /> link with button styling.
iconAlign"end" | "start"Align icon at the start or end within the btn.
start
targetstringOpen links in new tab. Only valid for anchor (when href is provided)
_activeSystemStyleObjectcss:active psudeo class overrides
{}
_focusSystemStyleObjectcss:focus psudeo class overrides
{}
_hoverSystemStyleObjectcss:hover psudeo class overrides
{}
forwardAs"symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | ... 157 more ... | FunctionComponent<...>-
$isBlockboolean-
$activePropsCssFunctionReturnType-
$focusPropsCssFunctionReturnType-
$hoverPropsCssFunctionReturnType-

Accessibility

  • When Button has focus, Space and Enter activates it.
  • If an href is passed, <Button/> will render as an anchor (<a/>)