DEV Community

Cover image for I wanted a home for my poems, so I wrote Solid.js ui components
夕水
夕水

Posted on

I wanted a home for my poems, so I wrote Solid.js ui components

Last month I tried to find a lyric I wrote four or five years ago. All I remembered was that it had both "rain" and "platform" in it. I searched three note apps, and eventually found it in one that had stopped shipping updates years ago — as a screenshot.

I didn't write any code that night. I just sat there wondering why I kept storing things like this.

They live at article.eveningwater.com now. 585 pieces, 657 poems, a bit over 54k characters, sorted into classical forms, ci, qu, modern poetry, lyrics, couplets, with tags and pagination.

How this started, boringly

I figured the public site was the whole job. Two months later I noticed it wasn't.

Fixing a typo meant opening a database client. Adding a poem meant writing SQL by hand. Uploading an image meant copying a path into a field by hand. Once I tried to fix a punctuation mark from the subway on my phone and simply couldn't, then sat there staring at it.

I built the admin panel when I got home.

Picking Solid wasn't a decision I agonised over. Fine-grained reactivity, no virtual DOM layer, JSX I don't have to relearn. For a content site — many pages, light interaction — it feels light.

What stopped me was the next step: finding a UI library.

Looking for a library got annoying

I wrote my requirements on paper. A full page of them: two layouts, forms with validation, a table, date picker, upload, charts, theming, dark mode, zh/en, and something usable for markdown editing.

The mature React options (Ant Design, Arco, that whole family) are complete and unusable here. I did seriously consider rewriting the whole site in React for about five minutes, then dropped it — I wanted to be using Solid.

Solid does have libraries. Most of them headless in spirit: careful interaction logic, solid accessibility, and no opinion about styles, themes, dark mode or copy. I wired up two components, started the third, and stopped. I was building a design system. If I'm building one anyway, I'd rather build it against my own requirements than someone else's API.

Others are narrower: buttons and modals, sure, but tables and date pickers don't exist; form controls are complete but the admin shell, tabs and breadcrumbs are yours to assemble.

None of that is a criticism. Different problems. I just couldn't find one shaped like mine.

So I wrote one.

Four components, then a runaway

At the start it was Button, Input, Modal, Table. Enough to run an admin panel.

Then things leaked. A list needs an empty state, so Empty. A table needs a status column, so StatusBadge. The admin needs light and dark, so theming. Switching the theme revealed that every icon was the wrong colour, so I drew a set (123 of them now).

Then the site itself started pushing. Long poems needed folding, which became long-image cropping. Sharing to WeChat needed a card image, which became a canvas-drawn SharePoster: 1080×1440, title, excerpt, tags, QR code, colours from theme tokens. I've never seen either of those in a UI library, but this site genuinely needs both.

Somewhere in there it stopped being "a few components for my site". I unified APIs, wrote tests, built a docs site. Today the core package is 84 components, 5 themes, zh/en built in, and no CSS-in-JS runtime.

Split so you only install what you use:

ew-solid-ui            84 core components + themes + i18n + headless hooks
ew-solid-pro           ProTable / ProForm / ProLayout / ProCard and 3 more
ew-solid-bits          12 effects and animated backgrounds
ew-solid-charts        ECharts wrapper
ew-solid-ui-admin      Admin shell: auth, layout, CRUD, router adapter
create-ew-solid-ui     CLI that scaffolds a working project
Enter fullscreen mode Exit fullscreen mode
pnpm add ew-solid-ui solid-js
Enter fullscreen mode Exit fullscreen mode

What's actually in those 84

"84 components" sounds like padding, so here's the inventory. Judge for yourself.

Basics: Button, Icon, Typography, Field, NumberInput, Checkbox, Chip, StatusBadge, Avatar, Empty, CodeBlock, Markdown, ColorPicker. Button has six variants and three sizes. Field covers input, password and textarea with prefix, suffix, error state, help text and autosize.

Markdown is the one I'm quietly pleased with. marked only lexes the text; Solid renders every node, which means any node can be swapped. I replaced the image node with my own preview and the code block with CodeBlock, so images zoom and code copies inside an article. I didn't plan that design — "the images in articles look terrible" forced it.

Media: EWImage for zoom and rotate; AutoImage handles long images, panning inside the crop box on hover with a progress bar underneath, so a tall screenshot feels like something you read. VideoPlayer and AudioPlayer wrap two players (quality switching, on-demand HLS, playlists, LRC lyrics). SharePoster as described. Plus QrCode and Watermark.

Layout: Layout, Grid (24 columns), Flex, Space, Divider, Splitter, Affix, Anchor with scroll spy, Breadcrumb, Masonry.

Forms: Form plus Select (single/multi/search, custom option rendering), AutoComplete, Cascader, TreeSelect, Transfer, Upload, DatePicker and range, Radio, Switch, Slider, Rate, InputOtp, Mentions, SliderCaptcha, Tree (checkable, lazy, draggable), ColorPicker.

Data: Table with fixed columns, sorting and pagination. PcMobData is my personal favourite — a table on wide screens that becomes a card list under 768px, with per-column hiding. That's the component that finally made my admin usable on a phone. The rest (List, Card, Descriptions, Statistic, Progress, Timeline, Calendar, Carousel, Segmented, Tag, Collapse, Tabs, Pagination) are ordinary and I won't pad this post describing them.

Feedback: Alert, Toast, Notification, Modal, Drawer, Confirm, Result, Spin, Skeleton, Tooltip, Popover, Tour, FloatButton, BackTop. Confirm is imperative — await confirmDialog(...) instead of a window.confirm and a piece of state in every page.

Navigation: Menu, Dropdown, Tabs, Breadcrumb, Anchor, Pagination.

The AI chat part is a port, honestly

I'd already written a Vue chat app called ew-chat. When the library needed a chat demo, I split that into components, pulled the state machine out, and rewrote it in Solid.

Bubble is the bubble: four variants, three shapes, start/end, loading dots, typewriter, hover-to-copy. BubbleList is the list with per-role presets. I got one thing wrong at first: if you rebuild the whole list during streaming, the page shivers for the entire reply. Updating only the last message fixed it. Sender is the composer — autosize, Enter to send, Shift+Enter for newline, IME-safe, stop button while generating. Conversations, Welcome, Prompts and Suggestion handle sessions and empty states.

Then the state machine became createChat under the headless entry: send / abort / reload / clear, no styles involved. If you don't like my UI, keep the logic and throw away the rest.

The chat page on the docs site and the project the CLI generates share one source file. Without an API key it streams a local demo reply; with one it talks to OpenRouter, eight free models included.

The docs site took more out of me than the components

I use it every day, so I'm the first person to be annoyed when it's bad.

Every component has a runnable demo and its source, following whatever theme and language you pick. The page I actually live in is Playground: TSX on the left, live preview on the right, no editing files and refreshing while tuning a component.

The theme lab lays out all five palettes and token tables. The JSON Schema page takes a schema on the left and renders a form on the right. The changelog reads CHANGELOG.md from the repo.

Documentation gets tedious, but it's also the fastest way to find the stupid parts of your own API. A couple of prop names only revealed themselves as nonsense while I was writing the docs for them.

Things I argued with myself about

No CSS-in-JS. Colours, spacing and radii are all --ew-* variables. Switching themes changes one set of variables, nothing computes styles at runtime, and SSR plus Tailwind coexist. The cost is expressiveness: unusual designs need new tokens.

Composition over duplication. The "more" menu in Conversations is Dropdown. Every Prompts item is a Button. Change Button's radius and everything follows. In other libraries the thing that drove me mad was four differently-shaped buttons in one kit, so I policed this one hard.

Accessibility as default behaviour, not a checkbox. Tab order, focus management, Esc and outside-click dismissal, ARIA wiring. I took wrong turns: Popover focus restoration took three attempts before it felt right.

zh/en built in. One LocaleProvider switch, including paginator labels, date panels and empty states. Plenty of libraries translate headings and leave the internals in English.

Headless stays separable. createChat, useSelect, useModal, useDatePicker, useDismiss, useCopy all work alone. Few dependencies, per-entry imports, tree-shakeable.

Things that broke

AutoImage cost me two evenings. Hovering left a grey veil over the image, and I was convinced my CSS was wrong. It was the vendor's progress container carrying a background colour; the real fix only arrived in version 0.0.2 upstream. You only find those by using the thing.

A friend once asked "so is it 84 components or 97?" because my docs said both — one number counted components, the other counted component pages. It's a single constant now, and the overview page says "97 component pages (84 core components plus extension packages)".

The CLI I caught before publishing: --template swallowed the project name, which meant the default admin template couldn't be generated at all. Untested, that's the first thing a new user hits.

The release pipeline had its own moment. A tag triggered the workflow, publishing the GitHub release triggered it again, and the second run died with a 409. It now re-checks the registry and continues if the version exists.

One I haven't fixed yet: ew-solid-pro pins peerDependencies to exactly ew-solid-ui@0.0.4, so a fresh pnpm install prints an unmet peer warning. Harmless, annoying, and it'll go out with the next release.

Where it stands

Version 0.0.5, 566 passing tests. Both scaffolds work with one command:

# Admin: login, layout, CRUD, schema forms, charts
pnpm create ew-solid-ui my-admin

# Online AI chat
pnpm create ew-solid-ui my-chat --template chat
Enter fullscreen mode Exit fullscreen mode

Next up are the three I personally miss most: tree table, editable table, virtual list. Not because a roadmap says so — because I keep needing them. Then a proper accessibility pass, a Vite plugin that imports per-component styles, and maybe open-sourcing the poetry site as a real-world example built with the library.

That's it. If you use Solid, or you're about to build an admin panel, a content site or an AI app with it, give it a try. If something feels off, open an issue — I'm reasonably fast.

Top comments (3)

Collapse
 
userxnom profile image
Abdullah Naseer •

The most honest line in here is that documentation is the fastest way to find the stupid parts of your own API. That plus the poetry site being the first consumer is the real QA loop — most component libraries get written for a hypothetical user, and it shows.

Two things I would steal: PcMobData, because most libraries treat responsive tables as a CSS problem and you treated it as a component decision, and the Markdown approach — letting marked lex while Solid renders every node is the kind of split that only makes sense once you have fine-grained reactivity underneath.

One question about the 566 tests: with 84 components, which one is the least covered relative to how much you fear changing it? My guess would be AutoImage's crop-and-pan math or the Table's fixed columns plus pagination, the places where interaction state, not rendering, is the risk. And on the unfixed peer pin — is the fix a peer range, or a release flow that bumps ew-solid-ui and ew-solid-pro together so the pin never goes stale again?

Collapse
 
eveningwater profile image
夕水 •

Ha, you guessed right, and I set myself up badly in the post by calling the other
package a "vendor". It's mine too. ew-auto-image is a separate package I publish,
which is exactly why AutoImage is the scariest thing to touch.

The crop-and-pan math isn't the problem by itself. The problem is that it sits
behind a package boundary: the component test in ew-solid-ui only proves wiring
and lifecycle, the real math is tested in the other repo, and a fix means
publishing upstream, bumping the dependency, then re-checking hover behaviour
here. I ran that loop for the grey-veil bug you read about, and it cost two
evenings mostly because I kept looking in the wrong package.

So AutoImage first, Table second. Table fails the opposite way: everything is in
one file, but fixed columns, sorting and pagination mutate each other, and the
76-line test asserts render and callbacks rather than those interactions. Sender
is third — composition/IME and caret restore are hand-tested on three browsers
because jsdom can't see any of it.

On the pin: a range, not lockstep. The extensions only use stable public APIs, so
^0.0.4 is fine, and lockstep would mean publishing four packages every time I fix
a button. What I'd add instead is a publish-time check that fails CI when an
extension's peer floor isn't satisfied by the core version being shipped.😀

Collapse
 
eveningwater profile image
夕水 •

Sorry, One correction to my own reply: I overstated Table. It's a plain table — column
definitions, row selection, loading, empty state, a scroll wrapper for wide
layouts. Sorting and pagination aren't baked in; ProTable composes them.

The component I actually fear changing is RangePicker: 651 lines of range
selection, keyboard navigation and month/year paging, and it has no dedicated
test file — only DatePicker does. Then Sender (IME, caret restore, autosize) and
BubbleList (sticky scroll while streaming). So your instinct about "interaction
state, not rendering" is right — I just named the wrong file.