# component

Styled DOM-component factory: pairs a creator function with a styling function for one self-contained component definition.

`component(create, style)` accepts a [`CreateFn`](https://www.hyperfrontend.dev/docs/libraries/utils/ui/component/#api-CreateFn) that builds the DOM tree and a [`StyleFn`](https://www.hyperfrontend.dev/docs/libraries/utils/ui/component/#api-StyleFn) that produces the per-instance CSS. The returned factory pairs the two so callers get a single function that yields a styled element ready to mount. Designed for small, framework-agnostic components in static pages, demos, and DOM-driven utilities; pick a real framework when you need lifecycle, state, or reactivity.

---

Canonical page: https://www.hyperfrontend.dev/docs/libraries/utils/ui/component/
This file: https://www.hyperfrontend.dev/docs/libraries/utils/ui/component.md
Documentation index: https://www.hyperfrontend.dev/llms.txt
