Widget
One section of a blog's sidebar.
View code
<aside aria-label="Sidebar">
<Widget>
<Widget.Heading>Recent posts</Widget.Heading>
<ul>
{recent.map((post) => (
<li>
<a href={post.href}>{post.title}</a>
<time datetime={post.date}>{post.day}</time>
</li>
))}
</ul>
</Widget>
<Widget>
<Widget.Heading>Categories</Widget.Heading>
<ul>
{categories.map((category) => (
<li>
<a href={category.href}>{category.label}</a> {category.count}
</li>
))}
</ul>
</Widget>
</aside>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { Widget } from "@sdxc/ui/blog";Renders a <section> named by its Widget.Heading, stacking the heading and the
rest of its children. Restyle the heading and its rule through
Widget.CustomProperties on the widget.
Composition
The parts the component publishes, each a static property of the host.
WidgetWidget.HeadingThe widget's title, ruled above in the brand colour and set small in upper case.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
Also accepts everything in TagProps<"section">.
Widget.Heading
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
level | HeadingLevel | — | No | Heading level; defaults to the ambient HeadingScope, or 2 without one. |
children | RemixNode | — | No |
Also accepts everything in TagProps<"h2">.