Carousel
Accessible, scroll-snap carousel without heavyweight slider dependencies.
Carousel navigation and visible slides
Use explicit previous/next buttons; test variable content lengths and reduced-motion settings.
<div class="xsh-carousel" data-xsh-visible="2"><div class="xsh-carousel-track"><article class="xsh-carousel-slide xsh-card">01 — Core</article><article class="xsh-carousel-slide xsh-card">02 — Components</article><article class="xsh-carousel-slide xsh-card">03 — Motion</article><article class="xsh-carousel-slide xsh-card">04 — Icons</article></div><div class="xsh-ref-flex"><button type="button" class="xsh-btn xsh-btn-outline" data-xsh-carousel-prev>← Previous</button><button type="button" class="xsh-btn xsh-btn-outline" data-xsh-carousel-next>Next →</button></div></div>Overview
Use xsh-carousel > xsh-carousel-track > xsh-carousel-slide. Add control buttons with data-xsh-carousel-prev and data-xsh-carousel-next.
Live example
Interactive · Real frameworkExample markup
<div class="xsh-carousel" data-xsh-visible="2">
<div class="xsh-carousel-track"><div class="xsh-carousel-slide xsh-card">01 — Design system</div><div class="xsh-carousel-slide xsh-card">02 — Interaction layer</div><div class="xsh-carousel-slide xsh-card">03 — Enterprise toolkit</div></div>
<div class="xsh-flex xsh-justify-between xsh-mt-4"><button class="xsh-btn xsh-btn-secondary" data-xsh-carousel-prev aria-label="Previous slide">← Previous</button><button class="xsh-btn xsh-btn-secondary" data-xsh-carousel-next aria-label="Next slide">Next →</button></div>
</div>Production guidance
Customize this component through --xsh-* CSS tokens, data-xsh-* configuration attributes and documented xsh-* utilities. Use the optional JavaScript distribution only when an interactive behavior is needed.
Complete selector inventory
These selectors exist in the current distribution. An entry in this table does not imply that arbitrary modifier combinations are meaningful; use the examples above for the intended composition.
| Class | Purpose | Delivery |
|---|---|---|
.xsh-carousel | Core component | CSS + optional behavior |
.xsh-carousel-slide | Composable modifier / structure class | CSS + optional behavior |
.xsh-carousel-track | Composable modifier / structure class | CSS + optional behavior |
Implementation details
Semantic structure
Use the documented Xshna classes with semantic HTML rather than replacing native elements unnecessarily.
Compose existing xsh- classes on the appropriate HTML element. Keep content order meaningful when CSS is disabled.
Interactive behavior
Verify focus order, disabled behavior and descriptive labels for interactive patterns.
Load xshna.min.js only if the documented interaction needs it. Your application remains responsible for data, persistence and business rules.
Responsive and localization
Test narrow containers, long translations and user-defined text sizes.
Test 320px-wide viewports, container-constrained instances, keyboard zoom, longer translations and right-to-left text where relevant.
Theme and customization
Use --xsh-* CSS variables for theme values and data-xsh-design / data-xsh-density on the xsh-app root.
Prefer design tokens over hard-coded overrides so components remain coherent across personalities.
What to verify before shipping
- Confirm every documented class used by the feature exists in the release CSS.
- Navigate controls using Tab, Shift+Tab, Enter, Space and Escape where appropriate.
- Test with reduced motion, high contrast, 200% text zoom and a narrow mobile viewport.
- Verify disabled, loading, empty, error and long-content states where relevant.
- Check actual application behavior independently of the preview: these examples use illustrative data.