SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

Widget

One section of a blog's sidebar.

View code
tsx
<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.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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.

  • Widget
  • Widget.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

PropTypeDefaultRequiredDescription
levelHeadingLevel—NoHeading level; defaults to the ambient HeadingScope, or 2 without one.
childrenRemixNode—No

Also accepts everything in TagProps<"h2">.

@sdxc/ui

Can’t find it? Contact us