Parts ship unstyled except for layout. Style them three ways, mixing freely:
- Classes and attributes passed to any part (
class,style,data-*), merged with the part’s own. - Data attributes describing state:
[data-pdf-page][data-current],[data-pdf-annotation][data-selected],[data-state='open']… With Tailwind:data-[current]:ring-2,group-data-[theme=dark]:…,[&_[data-part=title]]:font-medium. - CSS variables read by
styles.css(the optional default theme): page frame, accent, floating UI colours, side-note sizes. The full list is in Data attributes & CSS variables.
Cascade layer
styles.css and every component’s own style sit in the svelte-pdf-mini cascade layer, so any unlayered CSS of yours wins over them, whatever its specificity. With Tailwind v4, utilities should win too. Declare the layer order in your HTML <head>, before any stylesheet: a layer’s rank is fixed by its first mention, and component styles can load before your CSS (a later declaration in app.css then comes too late, and Tailwind’s base reset would override the library).
Inner parts
Default UIs (the selection menu, popover, citation card…) mark their pieces with data-part="…" — title, label, swatch, footer, hint… — so you can restyle without replacing them. Replace them entirely through children or child when you need different markup.
Wrap once, reuse everywhere
Build your design system’s versions of the parts once (shadcn-style), using child to render your own components:
--annotation-color on each annotation element (shapes, margin notes, markers, hover card), so your own styles can follow the annotation's colour.