DashboardCanvas
Create a workspace people can arrange, resize and personalize.
Live TypeScript example
Try the component here, then use the source below in your application.
- JavaScript
- 5.1 KiB
- Component CSS
- 1.6 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 13.8 KiB; component CSS 6.4 KiB. These figures describe browser assets, not the complete package download.
View all component measurements →Use Edit layout, then Layout options to move, resize, hide and restore panels without dragging. Panel content remains mounted and DOM order follows panel order.
import '@blukavantui/web/theme.css'
import {createDashboardCanvas} from '@blukavantui/web/dashboard-canvas';
import {createDashboardPanel} from '@blukavantui/web/dashboard-panel';
import {createStatistic} from '@blukavantui/web/statistic';
import {createSparkline} from '@blukavantui/web/sparkline';
import type {BluDashboardPanel} from '@blukavantui/web';
import '@blukavantui/web/dashboard-canvas.css';
import '@blukavantui/web/dashboard-panel.css';
import '@blukavantui/web/statistic.css';
import '@blukavantui/web/sparkline.css';
export function mount(host:HTMLElement) {
const content=document.createElement('div');host.append(content);
const metricHost=document.createElement('div'), taskContent=document.createElement('label');
const check=document.createElement('input');check.type='checkbox';taskContent.append(check,' Review customer import');
const metricPanel=createDashboardPanel(content,{PanelKey:'revenue',Content:metricHost});
const taskPanel=createDashboardPanel(content,{PanelKey:'tasks',Content:taskContent});
const panels:BluDashboardPanel[]=[{Key:'revenue',Title:'Revenue trend',ColumnSpan:7,RowSpan:3},{Key:'tasks',Title:'Team priorities',ColumnSpan:5,RowSpan:3}];
const canvas=createDashboardCanvas(host,{Panels:panels,Content:content,RowHeight:80},{SaveRequested:(requestId,layout)=>{
// Replace this storage call with your application's persistence API.
try {localStorage.setItem('bluui-starter:dashboard-canvas',JSON.stringify(layout));queueMicrotask(()=>canvas.update({SaveResultRequestId:requestId,SaveResultSuccess:true,SaveResultMessage:'Layout saved in this browser.'}));}
catch {queueMicrotask(()=>canvas.update({SaveResultRequestId:requestId,SaveResultSuccess:false,SaveResultMessage:'Layout could not be saved.'}));}
}});
const statistic=createStatistic(metricHost,{Label:'Monthly recurring revenue',Value:126840,Prefix:'$',Precision:0,Color:'Success'});
const sparkline=createSparkline(metricHost,{Points:[42,55,49,72,67,93,105,126].map((Value,i)=>({Label:'Week '+(i+1),Value})),Height:60,ShowArea:true,AccessibleLabel:'Revenue trend'});
return {destroy(){sparkline.destroy();statistic.destroy();canvas.destroy();metricPanel.destroy();taskPanel.destroy();}};
}
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.2.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.
createDashboardCanvas
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 { createDashboardCanvas } from '@blukavantui/web/dashboard-canvas';
import '@blukavantui/web/dashboard-canvas.css';Load @blukavantui/web/theme.css once in your app shell.createDashboardCanvas(host: HTMLElement, options: T.DashboardCanvasOptions, events?: T.DashboardCanvasEvents)Reference for @blukavantui/web 0.6.2. Required and optional follow the shipped TypeScript declarations; optional does not imply a particular default. Pass typed arrays and objects directly where shown.
Options
12| Name | Type / requirement | Usage |
|---|---|---|
Panels | BluDashboardPanel[]Required | Ordered panel definitions; echo OnLayoutChanged.LayoutJson back to this list. |
Columns | numberOptional | Desktop grid column count, 1 to 12. Default: 12. |
RowHeight | numberOptional | Grid row height in CSS pixels, 60 to 320. Default: 100. |
AllowEditing | booleanOptional | Shows layout editing controls. Default: True. |
IsDisabled | booleanOptional | Disables layout changes. Default: False. |
SaveResultRequestId | stringOptional | Echo the latest OnSaveRequested.RequestId after persistence finishes. Default: "". |
SaveResultSuccess | booleanOptional | True accepts the submitted snapshot; False retains editable changes. Default: False. |
SaveResultMessage | stringOptional | Success or failure feedback for the matching request. Default: "". |
ResetKey | stringOptional | Change this value to reload the supplied data and discard local history when not saving. Default: "". |
AccessibleLabel | stringOptional | Accessible component name; empty uses the component default. Default: "". |
ExtendedClass | stringOptional | Additional CSS classes on the Block root. Default: "". |
Content | SlotRequired | Content slot: pass a DOM node or a text string. Strings are rendered as text. |
Callbacks
3| Name | Type / requirement | Usage |
|---|---|---|
LayoutChanged | (layout: T.BluDashboardPanel[]) => void | Promise<void>Optional | |
SaveRequested | (requestId: string, layout: T.BluDashboardPanel[]) => void | Promise<void>Optional | |
Error | (message: string) => void | Promise<void>Optional |
Instance methods & properties
3| Name | Signature / type | Usage |
|---|---|---|
element | HTMLElement | Root owned by this instance. Dispose before removing its host. |
update | (patch: Partial<T.DashboardCanvasOptions>) => void | Apply a partial options update to this instance. |
destroy | () => void | Dispose the instance and its listeners when the view is removed. |
Related data types
Expand a type for its fields and allowed values.
BluDashboardPanel
interface BluDashboardPanel {
/** Unique stable key matching a DashboardPanel instance. */
Key: string;
/** Panel heading. */
Title: string;
/** Width in grid columns; clamped to the canvas column count. */
ColumnSpan?: number;
/** Height in row units, from 1 to 12. */
RowSpan?: number;
/** Hides the panel without destroying its content. */
IsHidden?: boolean;
}Slot
type Slot = Node | string;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
- Partially supported
- TypeScript
- Partially supported
- OutSystems
- Partially 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
Create a workspace people can arrange, resize and personalize.
Keyboard design guidance
Choose Edit layout, then Layout options to move, resize, hide or restore panels without dragging. Your entries are preserved.
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.