lunaDOM Docs
lunaDOM Docs

lunaDOM is a collection of lightweight, accessible shadowdom based web components built with JavaScript.

v0.0.25

The <luna-details> component provides collapsible sections with smooth animations, multiple visual styles, and accordion grouping support.

Paths

/lunadom/components/details/details.js REQUIRED

Basic Usage

What is lunaDOM? lunaDOM is a collection of lightweight, shadowDOM-based web components built with vanilla JavaScript. No dependencies, no build tools required.

Variant Styles

Card (default) - Solid background with border

Card Style This is the default card variant with a solid background and border. Perfect for standalone sections.

Ghost - Transparent with bottom border

Ghost Style Minimal ghost variant with no background, only a bottom border separator. Great for stacked lists.

Glass - Frosted glass effect

Glass Style Beautiful frosted-glass effect with backdrop blur. Works great on colorful or image backgrounds.

With Emoji Icons

📦 Package Details All components are individually importable. Import only what you need to keep bundle sizes minimal. Performance Optimized Built with vanilla JavaScript and optimized for performance. Each component is lightweight and fast. 🎨 Fully Customizable Every component can be styled using CSS custom properties. Match your brand with ease.

With SVG Icons

Verified Account Your account has been verified and all features are now unlocked. Important Notice Please update your billing information before the end of the month to avoid service interruption. Documentation Complete API reference and usage examples are available in the docs section.

Group Accordion

All details components with the same group attribute form an accordion - opening one closes the others.

How do I install lunaDOM? Install via npm: npm install github:dmac780/lunaDOM. Then import the components you need directly in your HTML. 💡 Do I need a build tool? No! All components are written in vanilla JavaScript and work directly in the browser. No bundler required. 🔧 Can I customize the styles? Yes! Every component exposes CSS custom properties for full customization. Override them to match your brand. 🌐 What browsers are supported? All modern browsers that support Web Components: Chrome, Firefox, Safari, and Edge (Chromium).

Disabled State

🔒 Premium Features (Locked) Upgrade to Pro to unlock advanced analytics, custom themes, and priority support.

Custom Styling

🎨 Custom Blue Theme This details component uses custom CSS properties to create a unique blue theme. All colors can be customized.

Customization

Slots
summary - Summary/header text
icon - Optional icon before summary
default - Content shown when expanded

Attributes
open - Whether initially open
disabled - Prevents toggling
group - Accordion key (opening one closes others)
variant - Visual style (card, ghost, glass, default: "card")

CSS Variables
--luna-details-bg - Background colour (default: #1a1a1a)
--luna-details-bg-open - Background when expanded (default: #1a1a1a)
--luna-details-border - Border colour (default: #2a2a2a)
--luna-details-border-open - Border colour when expanded (default: var(--luna-accent))
--luna-details-radius - Border radius (default: 1rem)
--luna-details-padding - Header/summary padding (default: 1rem 1.25rem)
--luna-details-body-padding - Body content padding (default: 0 1.25rem 1.25rem)
--luna-details-summary-color - Summary text colour (default: #eee)
--luna-details-summary-size - Summary font size (default: 0.9375rem)
--luna-details-content-color - Body text colour (default: #888)
--luna-details-content-size - Body font size (default: 0.875rem)
--luna-details-chevron-color - Chevron icon colour (default: #555)
--luna-details-icon-color - Prefix icon colour (default: var(--luna-accent))
--luna-details-divider-color - Divider line colour (default: #2a2a2a)
--luna-details-hover-bg - Summary row hover background (default: rgba(255,255,255,.03))
--luna-details-shadow-open - Box shadow when expanded (default: 0 8px 32px rgba(0,0,0,.35))
--luna-accent - Accent colour for chevron/focus/border (default: #2563eb)

Events
luna-show - Emitted when the panel opens
luna-hide - Emitted when the panel closes

Example Code

<!-- Basic usage --> <luna-details> <span slot="summary">What is lunaDOM?</span> lunaDOM is a collection of web components. </luna-details> <!-- With variant --> <luna-details variant="ghost"> <span slot="summary">Ghost Style</span> Minimal transparent style. </luna-details> <luna-details variant="glass"> <span slot="summary">Glass Style</span> Frosted glass effect. </luna-details> <!-- With emoji icon --> <luna-details> <span slot="icon">📦</span> <span slot="summary">Package Details</span> Content here. </luna-details> <!-- With SVG icon --> <luna-details> <svg slot="icon" width="16" height="16" viewBox="0 0 24 24"> <circle cx="12" cy="12" r="10"/> </svg> <span slot="summary">SVG Icon</span> Content here. </luna-details> <!-- Group accordion --> <luna-details group="faq" open> <span slot="summary">Question 1</span> Answer 1 </luna-details> <luna-details group="faq"> <span slot="summary">Question 2</span> Answer 2 </luna-details> <luna-details group="faq"> <span slot="summary">Question 3</span> Answer 3 </luna-details> <!-- Disabled state --> <luna-details disabled> <span slot="summary">Locked Content</span> Premium content. </luna-details> <!-- Custom styling --> <luna-details style=" --luna-details-bg: #0a0f1a; --luna-details-border-open: #3b82f6; --luna-details-icon-color: #3b82f6; " > <span slot="summary">Custom Theme</span> Styled content. </luna-details> <!-- Programmatic control --> <luna-details id="my-details"> <span slot="summary">Controlled Panel</span> Content here. </luna-details> <script> const details = document.getElementById('my-details'); // Open/close programmatically details.show(); details.hide(); // Listen to events details.addEventListener('luna-show', () => { console.log('Panel opened'); }); details.addEventListener('luna-hide', () => { console.log('Panel closed'); }); </script>