Button
Explore colors, variants, sizes, and interaction states.
Live TypeScript example
Try the component here, then use the source below in your application.
- JavaScript
- 0.8 KiB
- Component CSS
- 1.9 KiB
- Shared theme CSS
- 3.8 KiBonce per application
How sizes are measured
The JavaScript figure includes this component’s required helpers. CSS includes its styling dependencies. Each entry is bundled separately for ES2022, minified, then compressed with gzip level 9. Your bundler may share helpers across components. Images, fonts, examples and application code are excluded.
Before compression: JavaScript 1.7 KiB; component CSS 18.1 KiB. These figures describe browser assets, not the complete package download.
View all component measurements →Click Save changes to trigger the example callback.
import '@blukavantui/web/theme.css'
import {createButton} from '@blukavantui/web/button';
import '@blukavantui/web/button.css';
export function mount(host: HTMLElement) {
const output = document.createElement("p");
output.setAttribute("role", "status");
let clicks = 0;
const button = createButton(
host,
{ Label: "Save changes", Color: "Primary", Variant: "Filled" },
{
Click: () => {
clicks += 1;
output.textContent = `Save callback received (${clicks}). Connect your save request here.`;
},
},
);
host.append(output);
return {
destroy() {
button.destroy();
output.remove();
},
};
}
const instance = mount(document.getElementById('example')!)
// When this page or framework component is removed:
// instance.destroy()
Install the library and add the host element
npm install https://blukavantui.blutekmedia.com/downloads/blukavantui-web-0.6.0.tgz<div id="example"></div>This example uses the downloadable @blukavantui/web package. Your application handles persistence and authentication through its typed callbacks. The starter ZIP includes this same example.
createButton
Pass options as the second argument and callbacks in the third argument. Keep the returned instance to update options or dispose it when its view is removed.
import { createButton } from '@blukavantui/web/button';
import '@blukavantui/web/button.css';Load @blukavantui/web/theme.css once in your app shell.createButton(host: HTMLElement, options: ButtonOptions, events?: ButtonEvents)Reference for @blukavantui/web 0.6.0. Required and optional follow the shipped TypeScript declarations; optional does not imply a particular default. Pass typed arrays and objects directly where shown.
Options
13| Name | Type / requirement | Usage |
|---|---|---|
AccessibleLabel | stringOptional | Accessible name; keep the visible Label in this name. |
IsExpandable | booleanOptional | Marks a control as showing or hiding another region. |
IsExpanded | booleanOptional | The current expanded state of the controlled region. |
ControlsId | stringOptional | The DOM id of the region this control operates. |
IsCurrentPage | booleanOptional | Identifies a navigation control as the current page. |
Label | stringRequired | Visible text for this component. |
Color | ComponentColorOptional | A shared ComponentColor name. Colors adapt to the active appearance. |
Variant | "Filled" | "Outlined" | "Ghost"Optional | |
Size | "Small" | "Medium" | "Large"Optional | |
IsDisabled | booleanOptional | Disables interaction with this component. |
IsLoading | booleanOptional | Shows the loading state while work is pending. |
IsFullWidth | booleanOptional | Expands the component to the available width. |
ExtendedClass | stringOptional | Additional CSS class names on the component root. |
Callbacks
1| Name | Type / requirement | Usage |
|---|---|---|
Click | (event: MouseEvent) => void | Promise<void>Optional | Called when the enabled control is activated. |
Instance methods & properties
3| Name | Signature / type | Usage |
|---|---|---|
element | HTMLElement | Root owned by this instance. Dispose before removing its host. |
update | (patch: Partial<ButtonOptions>) => void | Apply a partial options update to this instance. |
destroy | () => void | Dispose the instance and its listeners when the view is removed. |
Exported helpers
buttonElement
buttonElement(p: ButtonOptions, events?: ButtonEvents): HTMLButtonElementRelated data types
Expand a type for its fields and allowed values.
Callback
type Callback<T extends unknown[] = []> = (...args: T) => void | Promise<void>;CommonOptions
interface CommonOptions {
ExtendedClass?: string;
}ComponentColor
type ComponentColor = typeof componentColors[number];Use these inputs, events, actions and structures in Service Studio. Names and data bindings are specific to the native Blocks.
Included in the planned free BluKavantUI Community edition. The official OutSystems Forge release is coming soon. View Community scope →
Open OutSystems showcase ↗- Web runtime
- Supported
- TypeScript
- Supported
- OutSystems
- Supported
Statuses describe the component’s rendered code and interactions. Supply accessible content and follow the component guidance when integrating it.
Accessibility guidance →Purpose and use
Use a Button to trigger an action. Give the main action a filled treatment; use outlined and ghost variants for supporting actions.
Keyboard design guidance
Tab moves between enabled buttons. Enter or Space activates a focused button. Disabled and loading buttons cannot be activated.
See the support status above for review coverage and any limitations.
In your application
Provide useful labels, preserve visible focus, and test the component with your actual content. Use text alongside status colors and check contrast in each state.
Events0No events yet.
Interact with an example to see its events.