Skip to content
View Markdown

Button ​

A control that runs an action when pressed.

tsx
import { Button, LabeledContent } from '@satinhq/kit'

Example ​

Click Add Book to increase the count.

Handle a press ​

Pass a function to onPress. Change state in that function to update the screen.

Choose a role or style ​

Use role="destructive" for destructive actions. The automatic style adapts to a list or toolbar. Explicit buttonStyle values include plain, bordered, borderedProminent and glass.

Use an icon alone ​

Set iconOnly and supply aria-label. The accessible label names the action.

API ​

Scroll horizontally to read every column.

PropTypeDescription
onPress() => voidCalled after a press.
symbolSymbolNameOptional icon.
roleButtonRoleAn optional semantic role.
disabledbooleanPrevents activation.
buttonStyleBuiltInButtonStyle | buttonStyle(_:)`Automatic contextual style by default.

Related: Quick start, List, Screen.

Button and Pressable keep their intrinsic label width in rows, stacks and grid cells. To fill the available width, give the immediate label a content frame with maxWidth: 'infinity'. A row-style automatic Button in List retains the List row allocation.

:::

Satin runs on the Lumen rendering engine and is open source under the MIT License.