Community project. This is not an official government website.

Run by volunteers. Lampung Design System is built by an open source community. No government agency runs or endorses it.

Official services use go.id. Government websites in Indonesia end in .go.id. Never enter your national ID number on a site you are unsure of.

Button

Button

The control people press to make something happen: save, send, start, delete. One primary per view; the label names the outcome.

Usage

Use it when

  • An action happens on this page or in this form: submit, save, start a task, open a dialog.
  • You need a loading state that keeps the width while the action runs (.is-loading with btn__label and btn__spin).

Use something else when

  • Going to another page with no side effect: use Link. A link is announced as navigation and opens in a new tab on middle click.
  • The control only shows an icon: use Icon button.
  • Turning a setting on or off that applies at once: use Switch.
  • Picking one view of the same content: use Segmented control.
  • A costly but not dangerous confirm (submit an exam, send payment): use Hold to confirm.

Where it goes. At the end of the thing it acts on: under a form (form__actions), at the bottom of a dialog (dialog__actions), in a card footer, or in a sticky bar on phones. The primary sits on the right on wide screens and on top (full width) on phones.

Examples

VariantsPrimary once per view; secondary for the alternative; tinted for a quiet positive; plain for inline and tertiary actions; danger only inside a confirm.
<div class="docs-row">
  <button class="btn btn--primary">Save changes</button>
  <button class="btn btn--secondary">Preview</button>
  <button class="btn btn--tinted">Add a note</button>
  <button class="btn btn--gray">Duplicate</button>
  <button class="btn btn--plain">Skip for now</button>
  <button class="btn btn--danger-tinted">Remove member</button>
</div>
Sizes and icons52 for the one big call to action on a landing page, 44 by default, 36 in toolbars and dense rows, 28 inside rows and chips. Small sizes keep a 44 px hit area through the space around them.
<div class="docs-row">
  <button class="btn btn--primary btn--lg"><span class="ic" aria-hidden="true">play_arrow</span>Start the tryout</button>
  <button class="btn btn--secondary"><span class="ic" aria-hidden="true">add</span>Add course</button>
  <button class="btn btn--secondary btn--md"><span class="ic" aria-hidden="true">download</span>Export</button>
  <button class="btn btn--plain btn--sm">Edit</button>
</div>
Loading without a jumpThe label blurs out, the spinner scales in, the width stays. Press it.
<button class="btn btn--primary is-loading" aria-busy="true">
  <span class="btn__label">Submit answers</span>
  <span class="btn__spin" aria-hidden="true"><span class="spinner"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span></span>
</button>
DisabledPrefer an enabled button that explains what is missing when pressed. Disable only when the reason is visible next to it.
Choose what kind of mistake it is to send the report.
<div class="docs-col" style="max-width: 360px;">
  <button class="btn btn--primary" disabled>Send report</button>
  <span class="field__help">Choose what kind of mistake it is to send the report.</span>
</div>

Anatomy

PartWhat it is
.btnRequired. The <button> (or <a> styled as one when it navigates). 44 px tall by default.
.btn--primary|secondary|…Required. One variant class; it sets color and finish.
.icOptional leading icon, 19 px, before the label.
.btn__labelWraps the text when the button can load, so the text can blur out without changing width.
.btn__spinThe spinner shown while .is-loading is on. Holds a .spinner with eight <i>.

Variants and sizes

Class or attributeWhen
btn--primaryThe main action of the view. Exactly one.
btn--secondaryThe alternative next to the primary (Cancel, Preview, Back).
btn--tintedA quiet positive action that should not compete with the primary.
btn--grayNeutral utility actions in toolbars.
btn--plainInline and tertiary actions; text only, accent color.
btn--dangerThe confirm button inside a destructive alert dialog only.
btn--danger-tintedA destructive action that still asks for confirmation afterwards.
btn--lg / btn--md / btn--sm52 / 36 / 28 px. Default is 44.
btn--blockFull width; the default for the primary in phone layouts and sheets.

States

StateHow
hoverAutomatic; only on devices that can hover.
:activeSinks to 97 % in 90 ms and springs back on release.
.is-loading + aria-busyLabel out, spinner in, width kept; clicks ignored. setLoading(btn, true) in plain HTML.
disabled / aria-disabled38 % opacity, no finish, not clickable.
.is-doneThe label rises in once after a success (pair with a toast or a text morph).

Motion and microinteractions

  • Press: transform: scale(0.97) on :active in 90 ms, back on --spring-snappy. Feedback starts on pointer down, not on release.
  • Loading: the label leaves with a 4 px blur in --d-fast; the spinner scales from 0.6 on --spring-snappy. Both are transitions, so turning loading off mid-way reverses smoothly.
  • Below 560 px a long label wraps onto two lines instead of pushing the layout sideways (--sm stays on one line).
  • For "Saved" after "Save", change the text with text morph instead of swapping the button.

Accessibility

  • Use <button type="button"> for actions and <button type="submit"> in forms; use <a href> only to navigate.
  • Icon-only buttons are icon buttons with an aria-label.
  • While loading set aria-busy="true"; announce the result with a toast or inline text.
  • The focus ring comes from the system (:focus-visible); never remove it.

Do and don't

Do

  • Name the outcome: "Save changes", "Send report", "Start the tryout".
  • Keep one primary per view; demote the rest to secondary, tinted or plain.
  • Make the primary full width in phone layouts (btn--block).

Don't

  • Write "Submit", "OK", "Click here" or "Continue" when a specific verb exists.
  • Restyle a button with a custom class (rounded pill, gradient, shadow). Pick a variant.
  • Use btn--danger outside a confirm, or two primaries side by side.

Behavior and code

Plain HTML. Optional. setLoading(button, true|false) toggles the loading state and aria-busy.

React. From lampung-design-system/react.

import { ButtonContent } from 'lampung-design-system/react';

<button className={`btn btn--primary${saving ? ' is-loading' : ''}`} aria-busy={saving} onClick={save}>
  <ButtonContent loading={saving}>Save changes</ButtonContent>
</button>