No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Button

A button indicates a possible user action.

usage
import { Button, IconButton, ToggleButton, ToggleIconButton, ButtonGroup, ButtonAsLink } from "@sharegate/orbit-ui";
sources
Github

Guidelines

When to use

  • To trigger an action such as submitting a form, exporting data.
  • To trigger a new UI element to appear on the page such as a modal.
  • Progressing or regressing a user through a step.

Content

  • Use strong, actionable verbs.
  • Avoid using "click here" or "start here" as copy.
  • When you need to link to another page, use a link component.

ToggleButton vs Switch

Usage

Default

A default button.

Editable example

Icon

A button can contain icons.

Editable example

End icon

Non standard end icons can be provided to handle special cases. However, think twice before adding end icons, start icons should be your go to.

Editable example

Counter

A button can contain a counter.

Editable example

Size

A button can vary in size.

Editable example

Disabled

A button can be disabled.

Editable example

Loading

A button can show a loading indicator. The button text is hidden but the button maintains the width that it would have if the text were visible.

Editable example

Fluid

A button can be expanded to full width to fill its parent container.

Editable example

Variants

A button can use different variants.

Primary

Used to indicate the main action of a page or a section. This is usually the action we want the user to take.

In a button group, there can be only 1 primary button. This will be reserved for the suggested action.

Editable example

Secondary

Secondary buttons are used for user actions that need less prominence in the page or the section. It’s also the button used when there are no suggested actions to the user.

Editable example

Tertiary

Tertiary buttons are used for actions that need to be there but that we don't want to encourage. A common use case would be a Cancel button in a message or an alert.

Editable example

Negative

Negative buttons are used for actions that would result in a deletion or another non recoverable negative action. These are mostly useful in modals.

Editable example

A button can be rendered as a link by using the ButtonAsLink component.

Editable example

Icon button

The content of a button can be a single icon. An accessible name must be provided through aria-label prop. See also WCAG practices.

Editable example

An icon button can be rendered as a link by using the IconButtonAsLink component.

Editable example

Button group

Buttons whose actions are related to each other can be grouped together.

Editable example

Orientation

A button group can render his items vertically.

Editable example

Alignment

A button group can change the alignment of his items.

Editable example

Toggle button

Offer a similar experience as a checkbox or radio with the appearance of a button.

Editable example

Toggle icon button

A toggle button content can be a single icon. An accessible name must be provided through aria-label prop. See WCAG practices.

Editable example

Toggle button group

Related toggle buttons can be group together in a group, a checkbox group or a radio group:

Editable example

Controlled

A toggle button can handle checked state in controlled mode.

Editable example

API

Button

usage
import { Button } from "@sharegate/orbit-ui";
slots
"icon", "text", "end-icon", "counter"
NameDescriptionDefault
autoFocus
Whether or not the button should autoFocus on render.
numberfalsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the button take up the width of its container.
false | true | ResponsiveValue<boolean>
-
inherit
Whether or not the button should inherit it's parent style.
falsetrue
-
loading
A button can show a loading indicator.
falsetrue
-
size
A button can vary in size.
"sm" | "md" | ResponsiveValue<"sm" | "md">
-
variant
The button style to use.
"negative""primary""secondary""tertiary"
-

IconButton

usage
import { IconButton } from "@sharegate/orbit-ui";
NameDescriptionDefault
autoFocus
Whether or not the button should autoFocus on render.
numberfalsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the button take up the width of its container.
false | true | ResponsiveValue<boolean>
-
inherit
Whether or not the button should inherit it's parent style.
falsetrue
-
loading
A button can show a loading indicator.
falsetrue
-
size
A button can vary in size.
"xs" | "sm" | "md" | "2xs" | ResponsiveValue<"xs" | "sm" | "md" | "2xs">
-
variant
The button style to use.
"negative""primary""secondary""tertiary"
-

ToggleButton

usage
import { ToggleButton } from "@sharegate/orbit-ui";
slots
"icon", "text", "end-icon"
NameDescriptionDefault
autoFocus
Whether or not the button should autoFocus on render.
numberfalsetrue
-
checked
A controlled checked value.
falsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
defaultChecked
The initial value of checked when uncontrolled.
falsetrue
-
fluid
Whether or not the button take up the width of its container.
false | true | ResponsiveValue<boolean>
-
inherit
Whether or not the button should inherit it's parent style.
falsetrue
-
loading
A button can show a loading indicator.
falsetrue
-
onChange
Called when the button checked state change.
(event: SyntheticEvent<Element, Event>, isChecked: boolean) => void
eventReact's original event.
isCheckedWhether the button is checked or not.
-
size
A button can vary in size.
"sm" | "md" | ResponsiveValue<"sm" | "md">
-
value
The value to associate with when in a group.
string
-
variant
The button variant to use.
ToggleButtonVariant
-

ToggleIconButton

usage
import { ToggleIconButton } from "@sharegate/orbit-ui";
NameDescriptionDefault
autoFocus
Whether or not the button should autoFocus on render.
numberfalsetrue
-
checked
A controlled checked value.
falsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
defaultChecked
The initial value of checked when uncontrolled.
falsetrue
-
fluid
Whether or not the button take up the width of its container.
false | true | ResponsiveValue<boolean>
-
inherit
Whether or not the button should inherit it's parent style.
falsetrue
-
loading
A button can show a loading indicator.
falsetrue
-
onChange
Called when the button checked state change.
(event: SyntheticEvent<Element, Event>, isChecked: boolean) => void
eventReact's original event.
isCheckedWhether the button is checked.
-
size
A button can vary in size.
"xs" | "sm" | "md" | "2xs" | ResponsiveValue<"xs" | "sm" | "md" | "2xs">
-
value
The value to associate with when in a group.
string
-
variant
The style to use.
ToggleButtonVariant
-

ButtonGroup

usage
import { ButtonGroup } from "@sharegate/orbit-ui";
NameDescriptionDefault
align
The alignment of the elements.
"center" | "end" | "start" | ResponsiveValue<FlexAlignment>
-
disabled
Whether or not the buttons are disabled.
falsetrue
-
fluid
Whether the elements take up the width & height of their container.
false | true | ResponsiveValue<boolean>
-
inline
Whether or not the element generate line breaks before or after himself.
falsetrue
-
orientation
The orientation of the elements.
"horizontal" | "vertical" | ResponsiveValue<FlexOrientation>
-
reverse
Whether or not to reverse the order of the elements.
falsetrue
-
size
The buttons size.
"sm" | "md" | ResponsiveValue<"sm" | "md">
-
wrap
Whether elements are forced onto one line or can wrap onto multiple rows.
false | true | ResponsiveValue<boolean>
-
usage
import { ButtonAsLink } from "@sharegate/orbit-ui";
NameDescriptionDefault
autoFocus
Whether or not the button should autoFocus on render.
numberfalsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the button take up the width of its container.
false | true | ResponsiveValue<boolean>
-
inherit
Whether or not the button should inherit it's parent style.
falsetrue
-
loading
A button can show a loading indicator.
falsetrue
-
size
A button can vary in size.
"sm" | "md" | ResponsiveValue<"sm" | "md">
-
variant
The button style to use.
"negative""primary""secondary""tertiary"
-
usage
import { IconButtonAsLink } from "@sharegate/orbit-ui";
NameDescriptionDefault
autoFocus
Whether or not the button should autoFocus on render.
numberfalsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the button take up the width of its container.
false | true | ResponsiveValue<boolean>
-
inherit
Whether or not the button should inherit it's parent style.
falsetrue
-
loading
A button can show a loading indicator.
falsetrue
-
size
A button can vary in size.
"xs" | "sm" | "md" | "2xs" | ResponsiveValue<"xs" | "sm" | "md" | "2xs">
-
variant
The button style to use.
"negative""primary""secondary""tertiary"
-