Button
Base Button command semantics, complete host usage, delivery and current boundaries.
Base Button is a focusable command control for one discrete action. It owns activation, disabled gating, focus, transient interaction facts and the outward click signal. The application supplies its visual presentation.
Preview
Section titled “Preview”The same composition contains “Run action” and “Disabled” in each host. The website preview uses workspace source; Vue 2 is the Vue 2.6 source profile, not part of the stable 0.2.0 install below.
Install
Section titled “Install”First initialize an existing application. For the published 0.2.0 Web Component baseline:
npx @proto.ui/cli@0.2.0 add wc base-button
With pnpm:
pnpm dlx @proto.ui/cli@0.2.0 add wc base-buttonReplace wc with react or vue for the stable React or Vue 3 facade. The CLI installs @proto.ui/prototypes-base and the corresponding @proto.ui/adapter-web-component, @proto.ui/adapter-react or @proto.ui/adapter-vue at its own exact version. It generates the local BaseButton export or proto-ui-base-button custom element.
The Vue 2 example requires the matching workspace 0.3 CLI/Adapter source and Vue >=2.6.0 <2.7. The published stable CLI does not accept vue2; do not substitute @latest and assume that it installs the source preview. A workspace manifest version is not proof of registry publication.
Start with the matching existing bundler application. Copy the host’s files below and keep the application’s framework mount entry. For Web Components, add the HTML to the existing document and load src/main.ts once. The registration import uses the CLI-generated tag, rather than the website’s private wc-base-button preview tag.
Both controls match the preview composition. The small stylesheet is application-owned presentation and requires no Tailwind setup. If the application already imports proto-ui-style.css, keep that import in one place.
Scroll to see all hosts →
import './styles/proto-ui-style.css';
import './base-button-demo.css';
import { setElementProps } from '@proto.ui/adapter-web-component';
import '../proto-ui/components/wc';
const disabledButton = document.querySelector('#disabled-action');
if (!(disabledButton instanceof HTMLElement)) throw new Error('Missing #disabled-action');
setElementProps(disabledButton, { disabled: true });<div class="base-button-examples">
<proto-ui-base-button class="base-button-example">Run action</proto-ui-base-button>
<proto-ui-base-button id="disabled-action" class="base-button-example is-disabled">Disabled</proto-ui-base-button>
</div>
<script type="module" src="/src/main.ts"></script>/* src/base-button-demo.css — application-owned presentation */
.base-button-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.base-button-example { border: 1px solid currentColor; border-radius: 0.25rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; font-weight: 500; }
.base-button-example.is-disabled { opacity: 0.5; }import './styles/proto-ui-style.css';
import './base-button-demo.css';
import { BaseButton } from '../proto-ui/components/react';
export default function App() {
return (
<div className="base-button-examples">
<BaseButton className="base-button-example">Run action</BaseButton>
<BaseButton className="base-button-example is-disabled" disabled>Disabled</BaseButton>
</div>
);
}/* src/base-button-demo.css — application-owned presentation */
.base-button-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.base-button-example { border: 1px solid currentColor; border-radius: 0.25rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; font-weight: 500; }
.base-button-example.is-disabled { opacity: 0.5; }<script setup lang="ts">
import './styles/proto-ui-style.css';
import './base-button-demo.css';
import { BaseButton } from '../proto-ui/components/vue';
</script>
<template>
<div class="base-button-examples">
<BaseButton class="base-button-example">Run action</BaseButton>
<BaseButton class="base-button-example is-disabled" :disabled="true">Disabled</BaseButton>
</div>
</template>/* src/base-button-demo.css — application-owned presentation */
.base-button-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.base-button-example { border: 1px solid currentColor; border-radius: 0.25rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; font-weight: 500; }
.base-button-example.is-disabled { opacity: 0.5; }<script>
import './styles/proto-ui-style.css';
import './base-button-demo.css';
import { BaseButton } from '../proto-ui/components/vue2';
export default {
components: { BaseButton },
};
</script>
<template>
<div class="base-button-examples">
<BaseButton class="base-button-example">Run action</BaseButton>
<BaseButton class="base-button-example is-disabled" :disabled="true">Disabled</BaseButton>
</div>
</template>/* src/base-button-demo.css — application-owned presentation */
.base-button-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.base-button-example { border: 1px solid currentColor; border-radius: 0.25rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; font-weight: 500; }
.base-button-example.is-disabled { opacity: 0.5; }Tab to “Run action” and activate it with Enter, Space or a pointer. “Disabled” must suppress activation and active focus requests; fading it with CSS alone would not disable it. Accessible names come from the authored text.
Protocol and events
Section titled “Protocol and events”P-BASE-BUTTON catalogs two authoring entries for the same protocol:
- the direct
base-buttonPrototype, exported asbuttonfrom@proto.ui/prototypes-base/button; - the authored
asButton()hook for a derived Prototype that needs Button semantics.
The only current Base prop is disabled. Exposed facts are disabled, hovered, focused, focusVisible and held-down pressed; focusSelf() requests focus. Successful activation emits the click outward signal. Framework facades translate that signal to their listener syntax (onClick in React, @click in Vue); it is not an onClick Prototype prop. The Web Component facade projects the signal as a custom event, separately from native DOM input.
Space participates in the press lifecycle and prevents its scrolling default. A disabled Button clears transient interaction state and emits no activation signal. Form submission, type, name, loading state and visual variants are outside the current Base guarantee. Application-owned busy behavior must drive the actual disabled input and expose meaningful progress/status; a spinner or opacity change alone is insufficient.
Use a native anchor with a real href for navigation. Do not nest it inside Button or replace its navigation with a click handler. Styled projections are documented separately: Shadcn Button and Brutalist Button.
| Prop | Type | Default |
|---|---|---|
disabled | boolean | false |
Delivery, lifecycle and evidence
Section titled “Delivery, lifecycle and evidence”The stable 0.2.0 package exports @proto.ui/prototypes-base/button and its CLI exposes base-button. The website’s four-host source preview and the older stable package are separate delivery surfaces. P-BASE-BUTTON remains draft; publication does not freeze its protocol or prove current browser/assistive-technology acceptance.