跪拜 Guibai
← Back to the summary

Lost Poem, Found Library: ew-solid-ui's 84 Solid Components

I wrote a backend for my poems and casually wrote 84 components

Last month I wanted to find a ci (a type of classical Chinese poetry) I wrote four or five years ago. I only remembered it contained both "rain" and "platform". I searched through three note-taking apps and finally found it in an app that stopped updating long ago, and only as a screenshot.

That night I didn't write code, just thought about why I kept my stuff so scattered.

Later, they all moved into article.eveningwater.com. 585 pieces, 657 poems, over 54,000 characters. Seven-character quatrains, five-character regulated verses, ci, modern poetry, lyrics, couplets — sorted into categories. You can browse by tags or paginate through them.

screenshot

The reason for all this is actually quite boring

After finishing the public page, I thought the whole thing was done. About two months later I realized it wasn't.

To fix a typo I had to open a database client. To add a poem I had to hand-write SQL. To upload an image I had to manually copy the path into a field. Once, on the subway, I wanted to change a punctuation mark on my phone and couldn't, so I just stared at the screen.

So I went back and built the admin backend.

The tech choice wasn't hard: Solid. Its reactivity is fine-grained, and for simple pages it feels very light. Writing JSX didn't require re-learning a whole new mental model. For a content site like this — "many pages, light interactions" — I thought it was a good fit.

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

Searching for a library got annoying

I wrote down my requirements on paper, a dense page: two layouts, forms and validation, tables, date pickers, upload, charts, theme switching, dark mode, Chinese/English, and a usable Markdown editor.

The mature React libraries (Ant Design, Arco, etc.) are comprehensive, but I couldn't use them. I seriously considered "just rewrite everything in React", but after five minutes, I gave up. I wanted to use Solid.

The Solid ecosystem does have libraries. The problem is most of them take a headless route: they handle interaction logic and accessibility, but leave styling, theming, dark mode, and internal copy entirely to you. I hooked up two components following the docs, and by the third I stopped — I was building my own design system. If I was going to do that anyway, I might as well build it the way I needed, at least to avoid an API I wouldn't want to use.

There are also some with narrower coverage. Buttons and modals exist, but tables and date pickers don't. Form controls are decent, but the admin layout, tabs, and breadcrumbs have to be assembled yourself.

This isn't a flaw on their part — their positioning is different. I just didn't find anything shaped exactly like what I needed.

So I wrote my own.

Runaway process that started with four components

In the beginning it really was just Button, Input, Modal, and Table. Enough for the backend to run.

Then the gaps started showing: lists needed empty states, so I made Empty; tables needed status columns, so I made StatusBadge; the backend needed light/dark switching, so I made themes; and once themes changed, icon colors looked off, so I drew a full set myself (now 123 icons).

After that, the poetry site's own needs drove development. Long poems folded, so I made long-image cropping; to share to WeChat Moments I needed an accompanying image, so I made SharePoster, a Canvas-based poster generator — 1080×1440, with title, summary, tags, QR code all included, and colors following the theme. I haven't seen those two components in any UI library, but this site genuinely needed them.

Gradually it stopped being "just for the poetry site". I started taking it seriously: unified APIs, added tests, set up a documentation site. Now the main package has 84 components, 5 themes, bilingual support, and no CSS-in-JS runtime.

01-home.jpg

02-components.jpg

It's split into several packages, so you only install what you need:

ew-solid-ui            84 base components + themes + i18n + headless hooks
ew-solid-pro           ProTable / ProForm / ProLayout / ProCard etc. — 7 in total
ew-solid-bits          12 effect and dynamic background components
ew-solid-charts        ECharts wrapper
ew-solid-ui-admin      Admin solution: login, layout, CRUD, route adaptation
create-ew-solid-ui     CLI, generates a project with one command
pnpm add ew-solid-ui solid-js

Roughly what these 84 components are

I know "84 components" sounds like a made-up number, so I'll spell it out and let you judge.

Base components: 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 as a set, with prefix/suffix, error states, helper text, and auto-height.

I'm quite pleased with the Markdown component. Marked only splits text into lexical nodes; rendering is entirely done by Solid, so every node can be replaced. I swapped image nodes for my own image preview, code blocks for CodeBlock, so when reading articles you can click images to zoom and copy code. That design wasn't thought up in advance — it was forced by "the images in articles are ugly".

Media: EWImage is a zoom/rotate preview; AutoImage handles long images — hover to pan within a crop box, with a progress bar at the bottom, making it feel like "reading" a long screenshot; VideoPlayer and AudioPlayer wrap two players as components, with resolution, HLS, playlists, and LRC lyrics; SharePoster was mentioned earlier; plus QrCode and Watermark.

Layout: Layout, Grid (24-column), Flex, Space, Divider, Splitter (draggable columns), Affix (sticky), Anchor (scroll highlighting), Breadcrumb, Masonry.

Forms: Form plus a bunch of controls: Select (single/multi, search, custom option rendering), AutoComplete, Cascader, TreeSelect, Transfer, Upload, DatePicker and range picker, Radio, Switch, Slider, Rate, InputOtp, Mentions, SliderCaptcha (slider verification), Tree (checkboxes, lazy loading, drag-and-drop), and ColorPicker.

Data display: Table supports fixed columns, sorting, pagination. PcMobData is my personal favorite: full-width tables that automatically switch to card lists below 768px, with configurable columns for the card view. After building it, the admin finally became usable on mobile. The rest are List, Card, Descriptions, Statistic, Progress, Timeline, Calendar, Carousel, Segmented, Tag, Collapse, Tabs, Pagination — all pretty standard, no need to elaborate.

Feedback overlays: Alert, Toast, Notification, Modal, Drawer, Confirm, Result, Spin, Skeleton, Tooltip, Popover, Tour, FloatButton, BackTop. Confirm is imperative — await confirmDialog(...) — so you don't need to stuff a dialog state into every page.

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

The AI chat part came from my other project

I previously wrote a Vue-based online chat called ew-chat. When building this component library, I decided to split the interface into components, extract the state machine, and rewrite it in Solid.

Bubble is a chat bubble: four appearances, three corner radii, left/right alignment, animated loading dots, character-by-character output, hover-to-copy. BubbleList is a list, configured per role. One detail I initially got wrong: during streaming output, if the whole list is rebuilt, the page keeps jittering while typing; I fixed it by only updating the last item. Sender is the input box, auto-height, Enter to send, Shift+Enter for newline, and it won't accidentally send when selecting characters in a Chinese IME; during generation it turns into a stop button. Conversations, Welcome, Prompts, Suggestion handle sessions and empty states.

Finally, I extracted the state machine as createChat into the headless entry: send / abort / reload / clear, with zero styling. If you don't like my interface, you can use just that to manage state.

04-chat.jpg

The chat page on the documentation site and the project generated by the CLI use the same source code. Without a key, it runs a local demo response; with a key, it connects directly to OpenRouter, which has eight free models built in.

Building the documentation site was harder than the components

Because I use it daily, I'm the first to suffer when it's bad.

Every component has a runnable example and source code. Examples follow the theme and language. But the page I open most is the Playground: TSX on the left, live preview on the right, so I can tweak components without editing files and refreshing the browser.

03-playground.jpg

The Theme Lab spreads out all five themes' color palettes and token tables. Change one variable and see the whole thing update. The JSON Schema page renders a form from a schema on the left. The changelog directly renders CHANGELOG.md from the repo.

Writing docs is easier to get bored with than writing components, but it's also better at exposing stupid parts of my API — a few times I only noticed a prop name didn't make sense while writing the docs, and went back to fix it.

Where I spent the most effort

No CSS-in-JS. All colors, spacing, and radii are --ew-* variables. Switching themes just changes one set of variables, with no runtime style computation, and it coexists fine with SSR and Tailwind. The trade-off is that themes can only express a limited set of things; flashy designs require adding new tokens.

Composition first. The "more" menu inside Conversations is just a Dropdown; each Prompts item is a Button. That way, changing Button's border radius changes all the buttons across the site. When I used other libraries, I hated seeing four different-looking buttons in one library, so I enforced this rule strictly when writing my own.

Accessibility is a default, not an option. Tab navigation works, focus isn't lost, Esc and clicking outside close things, and the ARIA attributes are all there. I took many detours here; the focus return in Popover took me to the third version before it felt right.

Bilingual support built in. A single LocaleProvider toggles everything — pagination, date panels, empty state copy all switch. Many libraries only translate their own titles, leaving component internals in English.

Headless and styled are separated. createChat, useSelect, useModal, useDatePicker, useDismiss, useCopy can all be used independently. The main package has few dependencies, components are exported by entry point, and tree-shaking works.

Failure log

AutoImage had a bug that took me two nights. When hovering over the image, a gray layer appeared. I was sure it was my CSS, but after digging and digging, it turned out to be the default background color of the vendor's progress bar container. It wasn't fully resolved until version 0.0.2. This kind of pitfall only shows up when you actually use it.

Another embarrassing one: a friend asked me, "So is it 84 or 97 components?" because the docs would say "component count" in one place and "page count" in another. Later I unified it to a single constant, and the overview page honestly says "97 component pages (84 core components plus extension packages)".

The CLI exposed a problem just before release: --template would swallow the project name, so the default admin template couldn't be generated at all. If I hadn't tested it, the user's first experience would have hit that.

The release process also had a failure. Pushing a tag triggered one pipeline, and releasing a Release triggered another; the one that arrived later got a 409 directly. Now I added some fault tolerance: if it fails, check once more, and if it already exists, just continue.

There's one I haven't fixed yet: the extension package ew-solid-pro has its peerDependencies pinned to [email protected], so a new project's pnpm install shows an unmet peer warning. It doesn't affect usage, but it's annoying every time it installs. I'll fix that in the next release.

Now, and next

Version 0.0.5, 566 tests. Both the admin and chat can be generated with one command:

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

# Online chat
pnpm create ew-solid-ui my-chat --template chat

05-admin.jpg

The next three things I want to do are tree tables, editable tables, and a virtual list — not because they're planned, but because I'm missing them the most right now. Then a full accessibility audit, and a Vite plugin to auto-import styles. I also have a thought about open-sourcing the poetry site itself, as a "real project built with this library".

That's it. If you're also using Solid, or building admin, content, or AI apps with it, give it a try. If something feels awkward, open an issue directly — I'm fairly quick to fix things.