BaseButton

An accessible button.
This unstyled component exists to standardise the wild behaviour across browsers, especially built-in button element. A button should be tabable, autofocus on click, and follow keyboard interactions and properties as described in WAI-ARIA specifications. With that reason, div - enriched with proper listeners and attributes is used as default element instead of button.
Based on the proposed CSS :focus-visible pseudo-selector, this prototype adds a data-focus-visible-added attribute to the focused element, in situations in which the :focus-visible pseudo-selector should match. data-focus-visible-added attribute is used instead of .focus-visible class because React overwrites your classes on rerender.
This selector is useful to provide a different focus indicator based on the user’s input modality (mouse vs. keyboard).

Example

Basic usage
Save...
Disabled
Call promise
View code

References

API

BaseButton
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
disabledboolean
Equivalent to button's disabled property.
keyboardClickKeysstring[]['Enter', ' ']
onBlurFocusEventHandler<HTMLDivElement>
onClickMouseEventHandler<HTMLDivElement>
onKeyDownKeyboardEventHandler<HTMLDivElement>
onKeyUpKeyboardEventHandler<HTMLDivElement>
onMouseDownMouseEventHandler<HTMLDivElement>
onMouseLeaveMouseEventHandler<HTMLDivElement>
onMouseUpMouseEventHandler<HTMLDivElement>
onReleaseEventHandler<SyntheticEvent<HTMLDivElement, Event>>
Callback that's triggered after click i.e. mouseup and keyup of enter or space.
onTouchEndTouchEventHandler<HTMLDivElement>
onTouchStartTouchEventHandler<HTMLDivElement>
    Example
    Example
    Basic usage
    Basic usage
    References
    References
    API
    API
    BaseButton
    BaseButton
Coral is a thoroughly developed design system widely adopted by developers and designers for creating beautiful and user-friendly Sea internal products.

Copyright © 2018-2025 Sea Labs