Skip to content
Xshna.cssv3.0.0
PlaygroundUtilities
PUBLIC API / VERSION 3.0.0

Complete API reference.

Stable hooks, exact parameters, supported data attributes, event contracts, design tokens and deployment behavior. No application-runtime dependency.

JavaScript methods

The public namespace is window.Xshna. Include xshna.min.js after the stylesheet. The combined bundle is idempotent at document scope.

Method / signaturePurposeReturnsNotes
Xshna.init(root = document)Initialize event delegation and tabsXshnaAdds keyboard/click listeners to provided root, idempotently; returns Xshna.
Xshna.refresh(root = document)Refresh dynamically added tab groupsXshnaRe-evaluates tab/panel selection, returns Xshna.
Xshna.destroy(root = document)Remove core delegated handlersundefinedRemoves registered core, advanced and pro document listeners when called with document; reinitialization remains supported.
Xshna.set(root, {theme,design,density,motion,brand})Update a scoped design configurationbooleanValidates allowed enumerations; hex brand computes high contrast black or white button text.
Xshna.toast(message, options)Create a text-only notificationHTMLElement | nulltype info|success|warning|danger, duration in milliseconds 0 to persist, root matching .xsh-app.
Xshna.openDialog("#xsh-id", opener)Open a native modal dialogbooleanRequires dialog inside xsh-app, focus returned on close.
Xshna.closeDialog(dialog)Close a native modalbooleanNative close event restores focus to opener.
Xshna.selectTab(group, tab, focus)Activate a keyboard-managed tabbooleanUpdates aria-selected, tabindex, and hidden panel state.
Xshna.toggleCollapse(trigger, force?)Toggle target panelbooleanThe trigger requires data-xsh-collapse="#xsh-panel-id"; force optionally boolean.
Xshna.accordionOpen(trigger)Toggle accordion itembooleanAutomatically collapses siblings when data-xsh-single exists.
Xshna.sortTable(button)Sort a DOM tablebooleanSupports text, number or date. First tbody only; sorting is local.
Xshna.filterTable(input)Filter table rowsnumberString matching over row text; returns visible row count.
Xshna.carouselMove(button)Move a scroll-snap trackbooleanNext/previous through trigger attributes.
Xshna.validateForm(form)Run native HTML constraint checksbooleanSets aria-invalid and optional error text; does not contact server.
Xshna.scrollSpy(element)Observe scroll locationfunction | falseReturns disconnect function; uses IntersectionObserver.
Xshna.refreshAdvanced(root)Initialize counters/accordion after DOM insertionundefinedApplies state to newly inserted advanced components.
Xshna.initAdvanced()Install advanced interaction listenersundefinedIdempotent; automatically activated by the complete bundle.
Xshna.destroyAdvanced()Release advanced global listenersundefinedDisconnects managed observers and allows clean reinstallation.
Xshna.initPro(root)Enable enterprise component interactionsXshnaCombobox, client-side paging, wizard and responsive nav; idempotent.
Xshna.destroyPro()Release enterprise listenersundefinedAlso called from Xshna.destroy(document).
Xshna.gridRefresh(table)Recalculate client-side grid paginationundefinedRe-run after replacing or changing table rows.
XshnaIcons.icon(name,{label})Create an inline SVG elementSVGElement | nullRequires optional xshna-icons.js; allowlisted icon names only.
XshnaIcons.mount(root)Render data-xsh-icon placeholdersundefinedBuilds inline SVGs without external sprite fetch.
XshnaInspector.scan(document)Scan development markupArraySeparate, optional debug script; not a WCAG audit.
XshnaInspector.highlight(root,true)Draw development guidesundefinedDebug-only visualization, never required in production.

Configuration and interaction attributes

AttributeValuesBehavior
data-xsh-themelight | dark | autoRoot color mode
data-xsh-designprecision | editorial | studio | playful | institutionalVisual personality
data-xsh-densityrelaxed | comfortable | compact | denseSpacing and control density
data-xsh-motionnone | subtle | expressiveMotion preference
data-xsh-branddynamicEnable custom brand tokens
data-xsh-open#xsh-dialog-idOpen a dialog
data-xsh-closepresenceClose ancestor native dialog
data-xsh-tabspresenceDesignate a tab group
data-xsh-dropdownpresenceDropdown container
data-xsh-dropdown-triggerpresenceDropdown toggle
data-xsh-toastmessageRender safe text toast
data-xsh-toast-typesuccess | info | warning | dangerToast status
data-xsh-collapse#xsh-idToggle hidden target
data-xsh-singlepresenceSingle open accordion
data-xsh-sorttext | number | dateSort table column
data-xsh-sort-valuetextOverride cell sort representation
data-xsh-filter#xsh-table-idFilter row text
data-xsh-filter-count#xsh-count-idWrite visible result total
data-xsh-counter#xsh-count-idCharacter counter
data-xsh-password-toggle#xsh-input-idToggle password visibility
data-xsh-select-all#xsh-container-idToggle checkbox group
data-xsh-validatepresenceRun native form validation
data-xsh-error-target#xsh-idField error destination
data-xsh-carousel-nextpresenceNext slide
data-xsh-carousel-prevpresencePrevious slide
data-xsh-observepresenceInitialize scrollspy
data-xsh-statussuccess | danger | warningStatus dot
data-xsh-elevationflat | raisedCard style
data-xsh-comboboxpresenceCombobox wrapper
data-xsh-paginate1-200Client-side data-grid page size
data-xsh-pagination#xsh-idPagination container
data-xsh-grid-search#xsh-table-idClient-side search binding
data-xsh-wizardpresenceMulti-step form container
data-xsh-steppresenceWizard step region
data-xsh-nextpresenceValidate and proceed
data-xsh-prevpresencePrevious wizard step
data-xsh-nav-toggle#xsh-panel-idResponsive sidebar toggle
data-xsh-iconallowlisted icon nameRequires optional inline icon utility

Custom events

Events bubble and are visible with document.addEventListener('xsh:tab-change', handler). Events do not perform remote requests.

EventDetailWhen fired
xsh:ready{version}Core initialization
xsh:config-change{theme, design, density, motion, brand}Design root updated
xsh:tab-change{tabId, panelId}Tab activated
xsh:dialog-open{}Native modal opened
xsh:dialog-close{}Native modal closed
xsh:dropdown-open{}Dropdown opened
xsh:dropdown-close{}Dropdown closed
xsh:toast{type}Toast dispatched
xsh:collapse{expanded}Collapse state changed
xsh:accordion-change{id, expanded}Accordion toggled
xsh:table-sort{column, direction}DOM sort complete
xsh:table-filter{query, count}Filter complete
xsh:form-valid{valid:true}Form passed checks
xsh:form-invalid{valid:false}Form blocked
xsh:carousel-change{index}Carousel requested next slide
xsh:select-all{checked,count}Bulk checkbox change
xsh:combobox-open{}Combobox expanded
xsh:combobox-select{value}Combobox option committed
xsh:grid-page{page,totalPages,rows}Paged grid updated
xsh:wizard-step{step,total}Wizard navigation

Core token registry

Override these token values inside the xsh-app root. Generated spacing and typography variables are additionally documented in the distribution source.

TokenScope
--xsh-fontInherited custom property
--xsh-font-monoInherited custom property
--xsh-bgInherited custom property
--xsh-surfaceInherited custom property
--xsh-surface-altInherited custom property
--xsh-textInherited custom property
--xsh-text-mutedInherited custom property
--xsh-borderInherited custom property
--xsh-primaryInherited custom property
--xsh-primary-hoverInherited custom property
--xsh-on-primaryInherited custom property
--xsh-primary-softInherited custom property
--xsh-on-primary-softInherited custom property
--xsh-successInherited custom property
--xsh-success-softInherited custom property
--xsh-warningInherited custom property
--xsh-warning-softInherited custom property
--xsh-dangerInherited custom property
--xsh-danger-softInherited custom property
--xsh-infoInherited custom property
--xsh-info-softInherited custom property
--xsh-focusInherited custom property
--xsh-shadow-colorInherited custom property
--xsh-1Inherited custom property
--xsh-2Inherited custom property
--xsh-3Inherited custom property
--xsh-4Inherited custom property
--xsh-5Inherited custom property
--xsh-6Inherited custom property
--xsh-8Inherited custom property
--xsh-10Inherited custom property
--xsh-12Inherited custom property
--xsh-radius-smInherited custom property
--xsh-radiusInherited custom property
--xsh-radius-lgInherited custom property
--xsh-radius-pillInherited custom property
--xsh-shadow-smInherited custom property
--xsh-shadowInherited custom property
--xsh-shadow-lgInherited custom property
--xsh-spaceInherited custom property
--xsh-control-heightInherited custom property
--xsh-card-paddingInherited custom property
--xsh-row-heightInherited custom property
--xsh-line-heightInherited custom property
--xsh-content-widthInherited custom property
--xsh-motion-fastInherited custom property
--xsh-motion-normalInherited custom property
--xsh-motion-slowInherited custom property
--xsh-easeInherited custom property
--xsh-brandInherited custom property
--xsh-brand-onInherited custom property

How to combine modules

<!-- Simple production deployment -->
<link rel="stylesheet" href="/static/xshna.min.css?v=3.0.0">
<script defer src="/static/xshna.min.js?v=3.0.0"></script>
<!-- Scoped root, no global reset -->
<div class="xsh-app" data-xsh-theme="auto" data-xsh-design="precision">
  <!-- Semantic HTML + xsh- classes -->
</div>

// Runtime configuration
const root = document.querySelector('.xsh-app');
Xshna.set(root, { design:'institutional', density:'comfortable' });
document.addEventListener('xsh:dialog-open', event => {
  console.log('Opened:', event.target.id);
});
Security boundaries: Xshna is a presentation library, not an authentication, validation or sanitization service. All application input must be validated server-side. Static tooltips are not safe locations for sensitive data; protect the data in your own application.