Button

A button primitive with native semantics and disabled state.

Native source
<button mlk-button type="button">Save changes</button>

<script type="module">
  import { Button } from '@milkui/core/button';
  Button.define(document);
</script>

Features

  • Renders a real button element.
  • React defaults to type="button"; native markup must specify its own type.
  • Supports disabled state in React props and native initial attributes.
  • React asChild composition, or a native marker attribute.

Anatomy

Native anatomy
<button mlk-button></button>

API reference

Set type="button" explicitly in native markup to prevent form submission. Authored disabled attributes seed the initial disabled prop; use instance.update() for later changes.

Button

PropTypeDefaultDescription
disabledbooleanfalseDisable the button.
AttributeValues
[disabled]Present when disabled
[mlk-button]Button marker

Examples

Disabled

Disabled buttons keep native button semantics and do not fire click actions.

Native source
<button mlk-button type="button" disabled>Save changes</button>

<script type="module">
  import { Button } from '@milkui/core/button';
  Button.define(document);
</script>

Keyboard interactions

Button renders a native button, so it follows browser button behavior.

KeyDescription
SpaceActivates the button.
EnterActivates the button.
TabMoves focus to the next focusable element.