Button

Buttons let people take an action, like saving, confirming, or going back.

Overview

Use a button when someone needs to do something on the screen. Terra has four button types. Primary, secondary, and ghost go from most important to least important. Destructive is separate and is for actions that delete something or can't be undone.

Every type comes in three sizes (sm, md, lg), can have icons, and can be shown as an icon-only button. Each type has 5 states: default, hover, focus, clicked, and disabled. That makes 120 variants in total: 4 types × 5 states × 6 (3 sizes + 3 icon-only sizes).

Anatomy

  1. Container: the shape of the button. Primary has a dark fill, secondary has a soft gray fill, destructive has a red outline, and ghost has no fill and no outline.

  2. Label: the button text.

  3. Leading icon (optional): an icon before the label.

  4. Trailing icon (optional): an icon after the label.

An icon-only button has a container and one icon. It has no label.

Props

Prop

Values

Notes

size

sm, md, lg


type

primary, secondary, ghost, destructive

Destructive is its own type, not a boolean.

state

default, hover, focus, clicked, disabled

In code, use the real states (hover, keyboard focus, pressed, disabled) instead of a prop.

label

string


leadingIcon

icon

Optional.

trailingIcon

icon

Optional. Can be used together with leadingIcon.

iconOnly

boolean

Hides the label. Needs an accessibility label.

Do and Don't

Do

Pair a primary button with a secondary or ghost button for the other actions.

Dont

Use multiple primary buttons for actions in the same group.

Do

Keep labels short and concise

Dont

Use unnecessarily long label, put additional label somewhere near the button and not inside the button

Do

Use an icon-only button only when the icon is easy to recognize.

Dont

Don't use icon-only buttons if the icon's meaning is unclear or the icon isn't used the same way elsewhere in the UI.


Types

Primary

The main action on the screen. It has the strongest look, so people notice it first.

  • When to use: the most important or most common action.

  • When not to use: when several actions matter equally. Use one primary button per screen.

Secondary

A softer button for actions that are less important than the primary.

  • When to use: actions that are less important than the primary, or the opposite of the primary.

  • When not to use: when it's the main action, or when there is no primary button on the screen.

Tertiary

A button with no fill and no outline. It takes very little space and keeps the screen calm.

  • When to use: the least important actions, such as a back button at the top of the screen. Also for sub actions when a primary and secondary button are already there.

  • When not to use: for actions that are used often or matter a lot. For destructive actions that someone might select by accident.

Destructive

A red outlined button that warns people an action can't be easily undone.

  • When to use: actions with a destructive or irreversible effect, such as deleting data.

  • When not to use: for any action that isn't destructive.

Because it keeps its outline, destructive looks stronger than secondary and ghost. This is on purpose, so people slow down before they choose it.


Variations

With icons

A button can have a leading icon, a trailing icon, or both.

  • When to use: when an icon helps people understand the action faster, like an arrow for going forward.

  • When not to use: as decoration. If the icon adds nothing, leave it out.

Without icons

A button with a text label and no icon.

  • When to use: as the default for most actions when the label clearly communicates the action.

  • When not to use: when an icon is necessary to clarify the action or indicate direction, such as navigating forward or opening an external link.

Icon only

A square button with just an icon. Width equals height.

  • When to use: inside components, when the action is universally recognized.

  • When not to use: when the icon's meaning is unclear, or when icon buttons aren't used consistently in the UI.

Sizes

Size

Height

Text

When to use

sm

36

md / medium

tight spaces, such as inside other components.

md

44

md / medium

The default size. Use it unless there is a reason not to.

lg

52

lg / medium

when the button needs more presence, like the main action on a mobile screen.

States

Default

The button is ready to use.

Hover

The button gets a slightly different look when the pointer is over it. Primary and secondary have their own hover colors. Ghost and destructive use 80% opacity. There is no hover on touch screens.

Clicked

The button is being pressed. Primary and secondary have their own clicked colors. Ghost and destructive use 60% opacity. Either way, people get immediate feedback that the press worked.

This state matters most on touch screens, where there is no hover. On desktop, it shows while the button is pressed.

Focus

A ring appears around the button when someone reaches it with a keyboard. Destructive buttons use a red ring.

Disabled

The button is not available right now. It can't be focused or tapped. It has intentionally low contrast, like most disabled controls. Ghost and destructive use 40% opacity.

  • When to use: when the action exists but can't be done yet.

  • When not to use: when the reason isn't clear. If someone can't tell why a button is disabled, explain it nearby.

Color

Buttons use color tokens, never the raw colors. The tokens point to black and the warm stone colors, so buttons stay soft and match the rest of Terra.

Primary and secondary

Primary and secondary are the buttons people tap the most, so they have their own colors for hover and clicked.

Type

Part

Default

Hover

Clicked

Primary

Background

primary-bg (black)

primary-hover (stone/700)

primary-clicked (stone/500)

Primary

Text and icon

primary-text (stone/50)

primary-text (stone/50)

primary-text (stone/50)

Secondary

Background

secondary-bg (stone/200)

secondary-hover (stone/300)

secondary-clicked (stone/400)

Secondary

Text and icon

secondary-text (stone/800)

secondary-text (stone/800)

secondary-text (stone/800)

Ghost and destructive

Ghost and destructive don't have their own hover, clicked, or disabled colors. They use opacity on the whole button instead: the text, the icon, and the outline.

State

Opacity

Default

100%

Hover

80%

Clicked

60%

Disabled

40%

  • Ghost has no fill and no outline.

  • Destructive has a red outline and red text. It uses the error colors, which Terra keeps for errors and destructive actions.

Focus ring

The focus ring is soft on purpose. It uses border/brand-focused (gold/300). Destructive buttons use border/error-focus (red/200).

Rules and behaviors

  • An icon-only button is square, so its width equals its height (36, 44, or 52). The padding is adjusted to keep it square.

  • Leading and trailing icons can be used together.

  • On touch screens there is no hover. The clicked state shows when the button is pressed.

  • The sm button is 36 tall, but its touch area is expanded to 44. Leave enough space between two small buttons so the touch areas don't overlap.

  • There is no loading state yet.

Best practice

  • Put a ghost button for going back at the top of the screen. It does the job without taking much space or drawing attention.

  • Order actions from most to least important: primary, then secondary, then ghost.

  • Keep destructive buttons away from the primary button if possible, so people don't tap one by mistake.

No headings found on page

Want to work together?

syahrulmiftahfarid@gmail.com

© 2026 Syahrul Miftah Farid

Want to work together?

syahrulmiftahfarid@gmail.com

© 2026 Syahrul Miftah Farid

Create a free website with Framer, the website builder loved by startups, designers and agencies.