Skip to content

aidenlx/zotlit / .agents/skills/obsidian-css

obsidian-css

Verified

Style Obsidian plugin UI Tailwind-first with native components. Use when writing or reviewing any styled React/JSX or CSS in apps/obsidian/ — picking colors, spacing, typography, borders, radius, shadows, dark-mode tokens, the `zt:` prefix, `.zt-root` preflight setup, component wrapper selection, or deciding between a utility, a native element, and a stylesheet.

FileKindSize
SKILL.mdskill md11.3 KB
check-references.mjsscript2.4 KB
modal-layout.mdmarkdown2.7 KB
references/components.mdmarkdown9.2 KB
references/editor.mdmarkdown14.0 KB
references/foundations.mdmarkdown10.1 KB
references/plugins.mdmarkdown2.0 KB
references/preflights.mdmarkdown3.4 KB
references/window.mdmarkdown3.7 KB

modal-layout.md

View on GitHub
# Modal layout: pinned title and buttons, scrolling body

Obsidian ships a modal mode for a dialog whose body can outgrow the window: the title and the button row stay put and only the content scrolls. Reach for it whenever a `Modal` has a form or list of unbounded height plus action buttons.

## The pattern

Two DOM facts make it work, and both are Obsidian's own (verified in Obsidian 1.14.0):

1. `modalEl` carries `mod-scrollable-content`.
2. The buttons live in a `.modal-button-container` that is a **sibling after** `.modal-content` inside `.modal`, never inside it.

```ts
override onOpen(): void {
  this.modalEl.classList.add("mod-scrollable-content");
  this.setTitle("…");
  this.contentEl.classList.add("zt-root");
  // …fill contentEl…
  const footer = this.modalEl.createDiv({ cls: "modal-button-container" });
  new ButtonComponent(footer).setButtonText("Save").setCta();
  new ButtonComponent(footer).setButtonText("Cancel");
}
```

For a React body, render the footer's buttons through `createPortal(…, footer)` from the same root, so one tree owns both regions.

Resulting DOM, in order:

```
.modal-container
└── .modal.mod-scrollable-content        display:flex; flex-direction:column; padding:0; overflow:hidden; max-height:var(--dialog-max-height)
    ├── .modal-close-button
    ├── .modal-header > .modal-title     padding: var(--size-4-4) var(--size-4-4) 0
    ├── .modal-content                   flex:1 1 auto; overflow:auto; padding: 0 var(--size-4-4) var(--size-4-4)
    └── .modal-button-container          margin-top:0; border-top: var(--border-width) solid var(--background-modifier-border); padding: var(--size-4-4)
```

The `.modal` is a flex column capped at `--dialog-max-height` (85vh), so the body grows with its content until that cap and then scrolls; the title and footer sit outside the scroll box. The footer's rules are `.modal.mod-scrollable-content .modal-button-container`, so the class on `modalEl` is what turns the plain flex-end button row into a pinned, bordered footer.

## What to leave alone

- The footer keeps the plain button row's `justify-content: flex-end; gap: var(--size-4-2); flex-wrap: wrap`. Order the buttons as Obsidian does: the `mod-cta` action first, then Cancel. A `.mod-secondary` button is pushed to the start on desktop.
- Padding moves from `.modal` onto the title, content, and footer under this mode. Keep `contentEl` free of extra horizontal padding.
- `.modal` width stays `--dialog-width` (560px). Widen only via a scoped class on `modalEl`; a `zt:` width utility loses to Obsidian's unlayered `.modal` rule.
- `mod-scrollable-content` is unrelated to `mod-sidebar-layout` (the community-browser two-pane modal). Combine neither with the other.
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall