Theme
On this page (2)

§The native-first principle

Traditional component libraries ship thousands of lines of JavaScript to implement behaviors that browsers now provide natively - dropdown positioning, modal focus trapping, popover light-dismiss, auto-growing textareas. defuss-shadcn eliminates that JavaScript entirely by building on the platform.

<!-- Dropdown: Floating UI + JS toggle
     + click-outside + focus trap
     + scroll lock + virtual positioning -->
<div class="dropdown-trigger" onclick="...">
  Open Menu
</div>
<div class="dropdown-panel"
  style="position:absolute;top:...;left:...">
  ...
</div>
<!-- Popover API + CSS Anchor Positioning
     Browser handles: positioning, light-dismiss,
     top-layer, and auto-flip -->
<button popovertarget="menu">
  Open Menu
</button>
<div id="menu" popover class="dropdown-content">
  ...
</div>

§API reference

Every native API available for the component library, what it replaces, and where it applies.

native APIs vs. traditional JS libraries
Native APIReplacesComponents
HTML Elements & Attributes
<dialog>JS modal + overlay + focus trapDialog, Alert Dialog, Sheet, Command
<details>/<summary>JS toggle + height animationAccordion, Collapsible
<details name> (exclusive)JS single-expand accordion logicAccordion (single mode)
<progress>Custom div-based progress barsProgress
<meter>Custom gauge componentsPassword strength, storage indicators
<output>Manual aria-live regionsSlider displays, form totals, live results
inertJS focus trap + aria-hidden togglingOverlays, collapsed sidebars, loading states
Popover APIJS show/hide, z-index management, click-outsidePopover, Dropdown, Tooltip, Toast, Combobox, Context Menu, Nav Menu
popover="hint"Custom tooltip z-index managementTooltip, descriptive hovers
Invoker Commands (commandfor/command)JS click handlers calling showModal()/togglePopover()Dialog, Alert Dialog, Sheet, Popover
CSS Layout & Positioning
CSS Anchor PositioningFloating UI, Popper.jsDropdown, Popover, Tooltip, Combobox, Nav Menu
Container QueriesViewport media queriesCard, Table
SubgridManually synchronized column widthsForm layouts, settings pages, description lists
Logical propertiesSeparate LTR/RTL stylesheetsAll components (RTL support)
Dynamic viewport units (dvh/svh/lvh)JS innerHeight hacks for mobile chromeFull-screen overlays, mobile layout
CSS Animations & Transitions
@starting-style + allow-discreteJS class toggling for enter/exit animationsAll overlays (Dialog, Sheet, Dropdown, Tooltip, Command, Accordion)
Individual transformsCompound transform stringsAccordion, composable animations
interpolate-size: allow-keywordsJS height measurement + max-height hacksAccordion, Collapsible, expanding UI
Scroll-driven animationsScroll listeners + IntersectionObserver for effectsProgress indicators, scroll reveals, parallax
View Transitions APIJS DOM-diffing + class-toggled crossfadesSPA navigation, tab switches, list reordering
@propertyJS-animated values, non-animatable custom propertiesProgress rings, gradient transitions
CSS Colors & Theming
oklch() + relative color syntaxHardcoded hex/hsl, manual color derivationAll tokens, all focus/hover states
color-mix()Sass darken()/lighten(), hardcoded variantsHover/disabled states, tinted backgrounds
light-dark()Media queries or class toggles for dark mode valuesInline light/dark switching
color-schemeManual dark overrides on native controlsDesign tokens (global)
accent-colorCustom-styled replacement form controlsSlider, Checkbox, Radio, Progress
CSS Selectors & Pseudo-classes
:has()JS class propagationLabel, Tabs, Avatar, Form
:focus-visibleJS focus-ring detectionAll interactive components
:user-valid / :user-invalidJS blur + class toggling for validationInput, Textarea, Select, Checkbox
:is() / :where()Repeated selectors, specificity hacksComponent resets, grouped selectors
::backdrop + backdrop-filterJS-managed overlay divs, canvas blurDialog, Alert Dialog, Sheet, Command
::details-contentJS measured height + animationAccordion, Collapsible
:popover-openJS class toggling for open stateAll popover components
:indeterminateJS class for indeterminate stateProgress, Checkbox
CSS Typography & Form
text-wrap: balanceJS text-balancing librariesTypography (headings)
text-wrap: prettyManual &nbsp; for orphan preventionTypography (body text)
field-sizing: contentJS auto-resize scriptsTextarea, Input
hanging-punctuationNegative text-indent hacksBlockquotes, pull quotes
CSS Scrolling
scroll-snapJS snap-to-slide calculationsCarousel
overscroll-behavior: containJS scroll-lock librariesCommand, Dropdown, Sheet, Scroll Area
scrollbar-gutter: stablePadding hacks for scrollbar widthCommand, Scroll Area
CSS Architecture
CSS nesting / @layerSass, Less, PostCSSAll components
@scopeBEM naming, Shadow DOM, CSS modulesScoped component styles
@supportsModernizr, JS feature detectionProgressive enhancement
@media (scripting)<noscript> onlyNo-JS fallbacks
CSS math (clamp/min/max/round)JS responsive calculationsFluid typography, responsive spacing
content-visibilityJS lazy renderingAccordion, Collapsible, Tree View
CSS Accessibility
prefers-reduced-motionNo motion accommodationAll animated components (critical for a11y)
prefers-color-schemeJS-only dark mode detectionAuto dark mode
prefers-contrastNo contrast accommodationAll components (high contrast support)
forced-colorsBroken styles in Windows High ContrastAll components (system color fallbacks)
JavaScript APIs
Web Animations APICSS class toggling for sequenced animationsToast
Intl.DateTimeFormatmoment.js, date-fnsCalendar
Intl.NumberFormatnumeral.js, manual formattingStatistic, Number Input
Intl.RelativeTimeFormattimeago.js, moment .fromNow()Timeline, activity feeds
Intl.ListFormatManual join/comma logicTag lists, multi-select displays
Drag and Drop APISortableJS, drag librariesSortable
CustomEventFramework event busesCalendar, inter-component communication
checkVisibility()Manual offset/dimension calculationsTree View
IntersectionObserverScroll listeners + getBoundingClientRect()Lazy loading, infinite scroll, reveal effects
ResizeObserverWindow resize listeners + pollingResponsive components, Carousel
MutationObserverPolling loops, framework lifecycleAuto-init for dynamically added components
Clipboard APIexecCommand('copy')Copy buttons, share links, code blocks
CloseWatcherManual Escape key listenersCustom overlays, full-screen views
ElementInternalsHidden <input> proxy patternsCustom form controls (Web Components)
FormDataManual value collection loopsForm, search, filters
AbortControllerBoolean flags, manual cleanupSearch-as-you-type, debounced fetches
structuredClone()lodash cloneDeep, JSON round-tripState management, undo/redo
Navigation APIHistory API hacks, router librariesSPA router, pagination
Selection APIRange/offset calculationsText editors, annotation features
View Transitions API (JS)DOM-diffing + class-toggled crossfadesSPA navigation, content swaps

These APIs are supported in the latest versions of Chrome, Edge, Firefox, and Safari. Some newer features (Invoker Commands, CSS Anchor Positioning, ::details-content, field-sizing, interpolate-size, View Transitions, Scroll-Driven Animations) may have varying cross-browser support - check Baseline for current compatibility status and each component's component-skill.md for the specific APIs used.

Comments, ideas or improvements? Edit this page's source on GitHub