Buttons

    Introduction

    A button is a clickable item used to execute an action either in the background or foreground.

    Button structure
    1. Button text
    2. Left icon
    3. Right icon
    4. Text underline - The underline is used for button link hover state.
    5. Border
    6. Background
    7. Focus border

    Examples

    Variants

    Primary

    Most of the time, a primary button is used when the consequent action is the main action of a layout.

    Secondary

    Secondary buttons are used to indicate supplementary actions

    Primary Outline

    A primary outline button is used when the consequent action is considered less important than the primary button but more important than the secondary button.

    Accent

    On some specific layouts (i.e. ask flow or payment), accent buttons overrule the primary buttons to indicate the most important actions.

    Positive

    Positive buttons are used for positive actions (i.e. when users finish a flow). They can be used to update the positive status of an action in view-only mode.

    Negative

    Negative buttons are used for negative actions (i.e. when users quit or stop an important flow).

    White

    Using it as a primary button in color or dark background.

    White Ouline

    Using it as a secondary button in color or dark background.

    Link

    The button link is the least prominent button. It's often standing next to other buttons to indicate a less important action.

    Having paddings, a button link is different, and also, represents a more important action than a text link.

    States

    Disabled

    Disabled buttons allow users to know the consequent actions but prevent them from executing these actions.

    Sizes

    Similar to input forms, buttons have three sizes: Small (28px), Medium (default - 36px) and Large (48px).

    Widths

    Default

    Flexible with the label inside the button.

    Min width

    The minimum width is 112px.

    Full width

    When a button’s width is set 100%, the button fully expands to the full width of its parent container.

    Buttons with icons

    Text & icon

    A button that contains a label and an icon on the left or right of the label.

    Orther Brand

    Microsoft

    Google

    Icon only

    A button that contains an icon only.

    Button Group

    The Button Group component shares the same styles and state as normal Buttons.

    The Button Group component shares the same sizes as normal Buttons. However, buttons in one group must be the same size.

    Design Reference

    Two or more primary buttons should not be placed next to each other. Different than a primary button, two or more secondary buttons can be used in one layout.

    Do
    Don't

    API

    Button

    import { Button } from  '@ahaui/react'Copy import code for the Button component
    NameTypeDefaultDescription
    variant
    'primary' | 'primary_outline' | 'secondary' | 'accent' | 'accent_outline' | 'positive' | 'positive_outline' | 'negative' | 'negative_outline' | 'white' | 'white_outline' | 'link'
    'primary'

    The Button visual variant

    textClassName
    string | arrayOf

    Fixed className for text color, just available for variant: primary, primary_outline, accent, accent_outline

    size
    'small' | 'medium' | 'large'
    'medium'

    Button size variants

    width
    'full' | 'auto' | 'min'
    'auto'

    Render full-width or min-width 112px button

    disabled
    boolean
    false

    Manually set the visual state of the button to :disabled

    as
    elementType
    <button>

    You can use a custom element type for this component.

    onlyIcon
    boolean
    false

    Use when the button has only Icon

    Button.Group

    import { Button } from  '@ahaui/react'Copy import code for the Button component
    NameTypeDefaultDescription
    sizeControl
    'small' | 'medium' | 'large'
    'medium'

    Sets the size for all Buttons in the group.

    disabledControl
    boolean
    false

    Sets the disabled state for all Buttons in the group.

    Powered by Got It, Inc.Slack