styling

Minimize Wrapper Elements

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "styling" with this command: npx skills add epicenterhq/epicenter/epicenterhq-epicenter-styling

Styling Guidelines

Minimize Wrapper Elements

Avoid creating unnecessary wrapper divs. If classes can be applied directly to an existing semantic element with the same outcome, prefer that approach.

Good (Direct Application)

<main class="flex-1 mx-auto max-w-7xl"> {@render children()} </main>

Avoid (Unnecessary Wrapper)

<main class="flex-1"> <div class="mx-auto max-w-7xl"> {@render children()} </div> </main>

This principle applies to all elements where the styling doesn't conflict with the element's semantic purpose or create layout issues.

Tailwind Best Practices

  • Use the cn() utility from $lib/utils for combining classes conditionally

  • Prefer utility classes over custom CSS

  • Use tailwind-variants for component variant systems

  • Follow the background /foreground convention for colors

  • Leverage CSS variables for theme consistency

Disabled States: Use HTML disabled

  • Tailwind Variants

When an interactive element can be non-interactive (empty section, loading state, no items), use the HTML disabled attribute instead of JS conditional guards. Pair it with Tailwind's enabled: and group-disabled: variants.

Why disabled Over JS Guards

  • disabled natively blocks clicks—no if (!hasItems) return needed

  • Enables the :disabled CSS pseudo-class for styling

  • Semantically correct for accessibility (screen readers announce "dimmed" or "unavailable")

  • Tailwind's enabled: and group-disabled: variants compose cleanly

Pattern

<!-- The button disables itself when count is 0 --> <button class="group enabled:cursor-pointer enabled:hover:opacity-80" disabled={item.count === 0} onclick={toggle}

{item.label} ({item.count}) <ChevronIcon class="group-disabled:invisible" /> </button>

Key Variants

  • enabled:cursor-pointer — pointer cursor only when clickable

  • enabled:hover:bg-accent/50 — hover effects only when interactive

  • group-disabled:invisible — hide child elements (e.g., expand chevron) when parent is disabled

  • disabled:opacity-50 — dim the element when disabled

Anti-Pattern

<!-- Don't do this: JS guard duplicates what disabled does natively --> <button class="cursor-pointer hover:opacity-80" onclick={() => { if (item.count > 0) toggle(); }}

The JS guard leaves cursor-pointer and hover:opacity-80 active on a non-interactive element. The user sees a clickable button that does nothing. Use disabled and let the browser + CSS handle it.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

svelte

No summary provided by upstream source.

Repository SourceNeeds Review
General

documentation

No summary provided by upstream source.

Repository SourceNeeds Review
General

writing-voice

No summary provided by upstream source.

Repository SourceNeeds Review