[Components](https://oods-foundry.com/components) / primitive

# Button

Triggers an action using a labelled native button.

Generated from @oods/foundry 0.10.2

- Categories

  primitive

- Contexts

  detail, form, list

- Readiness

  `proven-in-generated-apps`

## Playground

Documented example `button-activate` : pointer click or Enter, activation handler called once.

The render follows the page's theme switch: light, dark or high contrast. Both frameworks render the same example.

The real Button, live

React

Vue

Events it emits: activate. Use either render above, and each event shows here with the framework that sent it.



## Code

The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.

**React**

```
import { Button } from '@oods/components-react';
import '@oods/component-styles/css';

export function Example() {
  return (
    <Button
      content="Save changes"
      intent="neutral"
      size="md"
    >
      Save changes
    </Button>
  );
}
```

## Props, slots and events

Contract version 1.1.0. Types are from the React declarations in @oods/components-react.

Props

| Prop | Type | Required | Documented example |
| - | - | - | - |
| `content` | `ReactNode` | no | `Save changes` |
| `intent` | `ButtonIntent \| undefined` | no | `neutral` |
| `size` | `ButtonSize \| undefined` | no | `md` |
| `disabled` | `boolean \| undefined` | no | |
| `type` | `"submit" \| "reset" \| "button" \| undefined` | no | |

### Slots

default

### Events

activate

## States

default, hover, focus, pressed, disabled

## Accessibility

- Role

  `button`

- How it gets its name

  `label` on `button`

### Keyboard

Keyboard

| Key | What it does |
| - | - |
| `Tab` | Move focus to the named native control |
| `Enter` | Activate the control |

### Obligations in the contract

- Native button semantics
- Defaults to type=button

React asChild remains an extension and is not a Vue parity requirement.

## Tokens

The token roles this component reads.

- `button.background`
- `button.border`
- `button.text`
- `button.focus`

## Readiness

The evidence recorded for this component, with its label.

`proven-in-generated-apps`: catalog_list gives this label when generated React and Vue apps in the runtime sweep that ships with this version both use the component. That sweep was measured on the published 0.4.1, not on this version.

Readiness evidence

| Evidence | React | Vue |
| - | - | - |
| state | implemented-evidence-complete | implemented-evidence-complete |
| versioned contract | passed | passed |
| target implementation | passed | passed |
| package export | passed | passed |
| public declaration | passed | passed |
| dependency closure | passed | passed |
| framework scenario | passed | passed |
| accessibility | verified | verified |
| interaction | verified | verified |
| visual themes | verified | verified |

## Use your own

You can replace this component with your own React or Vue component. Map it, and generated code imports yours at the exact version you name. A contract report, run in a real browser, lists what your component met, what it didn't, and what wasn't checked.

The `component_map` call, with the parts in angle brackets yours to fill:

```
{
  "action": "create",
  "apply": true,
  "externalSystem": "<your design system>",
  "externalComponent": "<YourButton>",
  "oodsTraits": [
    "<trait names>"
  ],
  "substitution": {
    "component": "Button",
    "react": {
      "package": "<your-package>/react",
      "version": "<exact version>",
      "export": "<YourButton>"
    },
    "vue": {
      "package": "<your-package>/vue",
      "version": "<exact version>",
      "export": "<YourButton>"
    }
  }
}
```

## How this page was made

Generated at build from the published data, each source with the hash of what was read. [The page's manifest](https://oods-foundry.com/components/button/manifest.json).

- **Contract**: `@oods/component-contracts@0.10.2 componentContracts.Button` `sha256:2508fd1777fe…`
- **Documented example**: `@oods/component-contracts@0.10.2 sharedScenarios button-activate` `sha256:ac4f3682b7ba…`
- **Catalog entry (catalog_list)**: `generated/0.10.2/system/catalog.json Button` `sha256:bc53b6f9f0cc…`
- **React readiness**: `@oods/components-react@0.10.2 readiness Button` `sha256:b297266ac03e…`
- **Vue readiness**: `@oods/components-vue@0.10.2 readiness Button` `sha256:bc9144300e85…`
- **Prop types**: `generated/0.10.2/components/prop-types.json Button` `sha256:ad64a8fc899f…`
