Skip to content

OhMyUI! - Button

The Button is the primary interactive element in OhMyUI!. It supports three variants, three sizes and a disabled state.


Variants

VariantDescription
primaryMain call to action. Use for the most important action on a page.
secondarySecondary action. Use alongside a primary button for alternative actions.
ghostLow-emphasis action. Use for tertiary actions or in dense UI areas.

Sizes

SizePaddingFont size
sm4px 12px14px
md8px 16px16px
lg12px 24px18px

Angular

Import

typescript
import { ButtonComponent } from '@ohmyopensource/ohmyui-angular';

Usage

html
<ohmyui-button label="Click me" />
<ohmyui-button label="Click me" variant="secondary" />
<ohmyui-button label="Click me" variant="ghost" />
<ohmyui-button label="Click me" size="sm" />
<ohmyui-button label="Click me" size="lg" />
<ohmyui-button label="Click me" [disabled]="true" />

API

InputTypeDefaultDescription
labelstring''The button text
variant'primary' | 'secondary' | 'ghost''primary'Visual style
size'sm' | 'md' | 'lg''md'Button size
disabledbooleanfalseDisables the button

React

Import

typescript
import { Button } from '@ohmyopensource/ohmyui-react';

Usage

tsx
<Button label="Click me" />
<Button label="Click me" variant="secondary" />
<Button label="Click me" variant="ghost" />
<Button label="Click me" size="sm" />
<Button label="Click me" size="lg" />
<Button label="Click me" disabled />

API

PropTypeDefaultDescription
labelstring''The button text
variant'primary' | 'secondary' | 'ghost''primary'Visual style
size'sm' | 'md' | 'lg''md'Button size
disabledbooleanfalseDisables the button
onClick() => void-Click handler

Flutter

Import

dart
import 'package:ohmyui_flutter/ohmyui_flutter.dart';

Usage

dart
OhMyUIButton(label: 'Click me')
OhMyUIButton(label: 'Click me', variant: OhMyUIButtonVariant.secondary)
OhMyUIButton(label: 'Click me', variant: OhMyUIButtonVariant.ghost)
OhMyUIButton(label: 'Click me', size: OhMyUIButtonSize.sm)
OhMyUIButton(label: 'Click me', size: OhMyUIButtonSize.lg)
OhMyUIButton(label: 'Click me', disabled: true)

API

ParameterTypeDefaultDescription
labelStringrequiredThe button text
variantOhMyUIButtonVariant.primaryVisual style
sizeOhMyUIButtonSize.mdButton size
disabledboolfalseDisables the button
onPressedVoidCallback?nullTap handler

Tokens used

TokenUsage
--color-primary-500Primary background
--color-primary-600Primary hover background
--color-primary-50Secondary and ghost hover background
--color-neutral-0Primary text color
--font-family-sansFont family
--font-weight-mediumFont weight
--radius-mdBorder radius
--spacing-1 --spacing-2 --spacing-3 --spacing-4 --spacing-6Padding by size
--font-size-sm --font-size-md --font-size-lgFont size by size

Next steps

Released under the AGPL-3.0 License.