Sparkline
Compact trends with theme colors and readable underlying data.
Live TypeScript example
Try the component here, then use the source below in your application.
- JavaScript
- 3.1 KiB
- Component CSS
- 0.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 6.8 KiB; component CSS 1.4 KiB. These figures describe browser assets, not the complete package download.
View all component measurements →Open View trend data to read the numbers behind the chart.
import '@blukavantui/web/theme.css'
import {createSparkline} from '@blukavantui/web/sparkline';
import '@blukavantui/web/sparkline.css';
export function mount(host:HTMLElement){return createSparkline(host,{Points:[{Label:'Mon',Value:38},{Label:'Tue',Value:46},{Label:'Wed',Value:41},{Label:'Thu',Value:57},{Label:'Fri',Value:64}],Color:'Primary',Height:80,AnimateGlow:true,ShowArea:true,ShowDataTable:true,AccessibleLabel:'Completed requests this week'});}
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.
createSparkline
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 { createSparkline } from '@blukavantui/web/sparkline';
import '@blukavantui/web/sparkline.css';Load @blukavantui/web/theme.css once in your app shell.createSparkline(host: HTMLElement, options: T.SparklineOptions, events?: T.SparklineEvents)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
11| Name | Type / requirement | Usage |
|---|---|---|
Points | BluSparklinePoint[]Required | |
Height | numberOptional | |
Color | ComponentColorOptional | A shared ComponentColor name. Colors adapt to the active appearance. |
AnimateGlow | booleanOptional | One soft five-second line glow; defaults to false. Respects reduced motion. |
ShowArea | booleanOptional | |
ShowEndMarker | booleanOptional | |
ShowDataTable | booleanOptional | |
AccessibleLabel | stringOptional | Accessible name for assistive technology. |
SummaryText | stringOptional | |
EmptyText | stringOptional | |
ExtendedClass | stringOptional | Additional CSS class names on the component root. |
Callbacks
1| Name | Type / requirement | Usage |
|---|---|---|
Error | (message: string) => unknownOptional |
Instance methods & properties
3| Name | Signature / type | Usage |
|---|---|---|
element | HTMLElement | Root owned by this instance. Dispose before removing its host. |
update | (patch: Partial<T.SparklineOptions>) => 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.
BluSparklinePoint
One ordered numeric observation.
interface BluSparklinePoint {
Label?: string;
Value: number;
}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.
Part of the full commercial BluKavantUI for OutSystems edition. View OutSystems editions →
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
Pair a compact numeric trend with a metric or summary. Ordered point lists support negative, constant, empty and single values.
Keyboard design guidance
The SVG has a text summary. Tab to View trend data and press Enter to reveal the accessible data table.
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.