Skip to main content
Full documentation at velinstyle.info

Web Components

29 interactive Web Components with full keyboard support, ARIA attributes, and XSS-safe rendering.

velin-tabs

Tabbed interface with roving tabindex and arrow key navigation.

VelinStyle tabs use native roving tabindex. Arrow keys navigate between tabs.

  • Keyboard navigation
  • Automatic ARIA
  • Panel show/hide

Listen to velin-tab-change for tab switch events.

Events

NameDetail
velin-tab-change{ tab, index }

Slots

NameDescription
tabTab buttons with role="tab" (set aria-selected="true" for default)
panelTab panel content (matched by order)

velin-accordion

Native <details>/<summary> with optional exclusive mode. Arrow keys navigate between items. Panel styles use light-DOM CSS (slotted descendants cannot be styled with ::slotted()).

What is VelinStyle?

An accessibility-first CSS framework.

How do I install it?
npm install velinstyle
Can I customize it?

Yes! Override CSS custom properties or use theme presets.

Attributes

NameTypeDefaultDescription
exclusivebooleanfalseOnly one item open at a time

Keyboard

KeyAction
ArrowUp/DownNavigate between summaries
Home / EndJump to first/last item
Enter / SpaceToggle the focused item (native details)

velin-toast

Notification toasts with aria-live region.

Methods

NameParametersDescription
show(options){ message, type, duration }Show a toast. Types: success, warning, danger, info. Duration in ms (0 = sticky).

velin-drawer

Slide-in panel with focus trapping. Supports all 4 sides.

Settings panel content goes here.

Attributes

NameTypeDefaultDescription
titlestring""Drawer heading
sidestring"start"Position: start, end, top, bottom
openbooleanfalseShow/hide (reflected)

Methods

NameDescription
open()Open the drawer
close()Close the drawer

Events

NameDetail
velin-closeFired on close

velin-popover

Popover with click, hover, or focus trigger. Auto role (tooltip/dialog).

This popover opens on click. Press Escape to close.

This popover opens on hover/focus.

Attributes

NameTypeDefaultDescription
placementstring"bottom"top, bottom, start, end
triggerstring"click"click, hover, focus
titlestring""Popover heading (optional)

Methods

NameDescription
open() / close() / toggle()Programmatic control

velin-tooltip

Pure-CSS tooltip with auto-flip and keyboard support.

Attributes

NameTypeDefaultDescription
contentstring""Tooltip text (XSS-safe)
placementstring"top"top, bottom, start, end

velin-collapse

Expandable/collapsible content section.

This content can be expanded and collapsed. Supports open(), close(), and toggle() methods.

Attributes

NameTypeDefaultDescription
openbooleanfalseExpanded state (reflected)

Methods

NameDescription
open() / close() / toggle()Programmatic expand/collapse

Events

NameDetail
velin-openFired when expanded
velin-closeFired when collapsed

velin-dialog

Native <dialog> wrapper for alert, confirm, and prompt. Returns a Promise.

Methods

NameParametersReturns
alert(message, opts){ title, confirmText }Promise<true>
confirm(message, opts){ title, confirmText, cancelText, danger }Promise<boolean>
prompt(message, opts){ title, confirmText, cancelText, placeholder, defaultValue }Promise<string|null>

Events

NameDetail
velin-dialog-close{ value }

velin-stepper

Multi-step progress indicator with panel management.

Step 1: Create your account.

Step 2: Fill in your profile details.

Step 3: Review and confirm everything.

Attributes

NameTypeDefaultDescription
labelsstring""Comma-separated step labels
activenumber0Current active step (0-based)

Methods

NameDescription
next()Go to next step
prev()Go to previous step
goTo(index)Jump to specific step

Events

NameDetail
velin-step-change{ step }

velin-countdown

Live countdown timer with role="timer" and aria-live.

Attributes

NameTypeDescription
datetimestringISO date string target (e.g. 2027-01-01T00:00:00)
show-daysstringSet "false" to hide days segment
label-daysstringCustom label for days (default: "Days")
label-hoursstringCustom label for hours
label-minutesstringCustom label for minutes
label-secondsstringCustom label for seconds
sizestringsm or lg for size variants

Events

NameDetail
velin-countdown-endFired when countdown reaches zero

velin-progress-ring

Circular progress indicator with role="progressbar".


Attributes

NameTypeDefaultDescription
valuenumber0Progress value (0-100)
sizenumber60Diameter in pixels
strokenumber4Stroke width
colorstringprimaryCSS color for the progress arc

velin-copy

One-click copy-to-clipboard button.

Click to copy npm install velinstyle to clipboard.

Attributes

NameTypeDescription
valuestringText to copy to clipboard

Events

NameDetail
velin-copiedFired after successful copy

velin-theme-toggle

Light/dark mode toggle with localStorage persistence. Click the button to switch between light and dark mode.

Current: light

Attributes

NameTypeDefaultDescription
targetstring"html"CSS selector for element to toggle data-velin-theme on

Events

NameDetail
velin-theme-change{ theme, dark }

velin-scroll-top

Floating back-to-top button that appears on scroll.

Scroll down the page to see the button appear in the bottom-right corner.

Attributes

NameTypeDefaultDescription
thresholdnumber300Scroll distance (px) before button appears

Custom Properties

PropertyDefaultDescription
--velin-scroll-top-bottom1remBottom offset
--velin-scroll-top-end1remInline-end offset

velin-scrollspy

Highlights navigation links based on scroll position.

Wrap a <nav> with links that match section IDs. As user scrolls, active link gets highlighted.

<velin-scrollspy>
  <nav>
    <a href="#section-1">Section 1</a>
    <a href="#section-2">Section 2</a>
  </nav>
</velin-scrollspy>

Events

NameDetail
velin-spy-change{ id, link } of the currently active section

velin-persist

Auto-saves form data to localStorage. Survives page reload. Password/file fields excluded for security.

Type something, reload the page -- your input persists!

Attributes

NameTypeDefaultDescription
keystring"default"Storage key identifier (alphanumeric, max 64 chars)
storagestring"local""local" or "session" for sessionStorage

Methods

NameDescription
clear()Remove saved data from storage

Events

NameDetail
velin-persist-restore{ data } -- Fired after data is restored from storage
velin-persist-clearFired after data is cleared
velin-persist-error{ error: "quota" } -- Storage quota exceeded

velin-haptic (Utility)

Device vibration feedback for buttons and interactions. Works on supported mobile devices.

Add haptic="pattern" to any element. Patterns: tap, double-tap, error, success, warning.

HTML API

AttributeValuesDescription
haptictap, double-tap, error, success, warningVibration pattern triggered on click

JS API

ExportDescription
vibrate(pattern)Trigger vibration with a duration array
applyHaptic(el, pattern)Bind haptic click handler to element
VelinHapticObserverMutationObserver that auto-applies [haptic] attribute

velin-icon

SVG icon component with multi-provider support. See Icons page for the full icon gallery.

<!-- Local sprite (default) -->
<velin-icon name="check" size="24"></velin-icon>

<!-- External provider (CDN) -->
<velin-icon name="heart" provider="lucide"></velin-icon>
<velin-icon name="academic-cap" provider="heroicons"></velin-icon>

<!-- Custom sprite -->
<velin-icon name="custom" sprite="my-icons.svg"></velin-icon>

Attributes

NameTypeDefaultDescription
namestringrequiredIcon name
sizenumber24Width and height in pixels
labelstring""Accessible label (sets role="img" + aria-label)
spritestring"velin-icons.svg"Custom sprite path
providerstring""External icon provider: lucide, heroicons, bootstrap, material, fontawesome, tabler

Providers

ProviderIconsLicense
lucideLucide (Feather fork)ISC
heroiconsHeroicons (Tailwind Labs)MIT
bootstrapBootstrap IconsMIT
materialMaterial Symbols (Google)Apache 2.0
fontawesomeFont Awesome (Free)CC BY 4.0
tablerTabler IconsMIT

JS API

MethodDescription
VelinIcon.registerProvider(name, urlTemplate)Register a custom icon provider at runtime. Use {name} as placeholder.
VelinIcon.providersReturns array of registered provider keys

CLI

CommandDescription
velinstyle icons listShow available providers and installed icons
velinstyle icons add <provider> --icons name1,name2Download icons from a provider into the local sprite
velinstyle icons remove <provider>Remove all icons from a provider
velinstyle icons buildRebuild the SVG sprite

velin-combobox

Autocomplete listbox with a trigger in the trigger slot.

EventsDetail
velin-select{ option }

velin-bottom-nav

Mobile bottom navigation; set current to match data-nav on links.

velin-sheet

Bottom sheet with focus trap. Methods: open(), close().

Sheet body.

velin-segmented-control

velin-rating

velin-calendar

Month calendar. value (ISO date), optional min/max, event velin-change. Keyboard: arrows, Home/End, PageUp/Down, Enter.

velin-file-dropzone

Client-side dropzone. Events velin-files / velin-error. Does not upload to a server — wire your API.

velin-command

Command palette. Close with Escape, backdrop click, or toggle(). Closed overlay does not intercept pointer events.

Methods

NameDescription
open()Open the palette
close()Close the palette
toggle()Toggle open/close

velin-announcer

Live region for screen readers. Static helper: VelinAnnouncer.announceGlobal().

Theme waehlen