Implementation:TobikoData Sqlmesh Button
| Knowledge Sources | |
|---|---|
| Domains | Web_UI, Design_System, User_Interface |
| Last Updated | 2026-02-07 20:00 GMT |
Overview
Button is a comprehensive button component system supporting multiple variants, sizes, shapes, formats, and accessibility features with consistent styling across light and dark themes.
Description
The Button component implements a flexible button system with extensive customization options through variant, size, shape, and format parameters. It supports eight semantic variants (primary, secondary, success, danger, warning, info, neutral, alternative) with consistent color schemes. The component offers four shape options (rounded, square, circle, pill) and four format styles (solid, outline, ghost, link). The implementation uses a higher-order component pattern (makeButton) that wraps base button implementations, enabling both standard button elements and div-based button links. The component includes comprehensive accessibility support with keyboard navigation, focus management, auto-focus capabilities, and disabled state handling that prevents interactions and applies appropriate visual styling.
Usage
Use Button throughout the UI for all interactive actions, form submissions, and navigation triggers. Choose appropriate variants to convey action semantics (primary for main actions, danger for destructive operations, etc.).
Code Reference
Source Location
- Repository: TobikoData_Sqlmesh
- File: web/client/src/library/components/button/Button.tsx
Signature
export interface PropsButton
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: ButtonVariant
size?: ButtonSize
shape?: ButtonShape
format?: ButtonFormat
value?: string
form?: string
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void
}
const Button = makeButton(
React.forwardRef<HTMLButtonElement, PropsButton>(ButtonPlain),
)
const ButtonLink = makeButton(
React.forwardRef<HTMLDivElement, PropsButton>(ButtonLinkPlain),
)
export { Button, ButtonLink, EnumButtonShape, EnumButtonFormat }
Import
import { Button, ButtonLink, EnumButtonShape, EnumButtonFormat } from '@components/button/Button'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| variant | ButtonVariant | No | Color variant (primary, secondary, success, danger, etc.) |
| size | ButtonSize | No | Size variant (xs, sm, md, lg) |
| shape | ButtonShape | No | Shape style (square, rounded, circle, pill) |
| format | ButtonFormat | No | Format style (solid, outline, ghost, link) |
| disabled | boolean | No | Disable button interactions |
| onClick | Function | No | Click event handler |
| className | string | No | Additional CSS classes |
| children | React.ReactNode | No | Button content |
Outputs
| Name | Type | Description |
|---|---|---|
| JSX.Element | React component | Styled button element with full accessibility support |
Usage Examples
import { Button, EnumButtonShape } from '@components/button/Button'
import { EnumSize, EnumVariant } from '~/types/enum'
function ActionBar() {
return (
<div>
<Button
variant={EnumVariant.Primary}
size={EnumSize.md}
onClick={() => console.log('Apply clicked')}
>
Apply Changes
</Button>
<Button
variant={EnumVariant.Danger}
size={EnumSize.sm}
disabled={false}
onClick={() => console.log('Cancel')}
>
Cancel
</Button>
<Button
variant={EnumVariant.Alternative}
shape={EnumButtonShape.Circle}
size={EnumSize.sm}
>
<SearchIcon className="w-4 h-4" />
</Button>
</div>
)
}