# Core

The engine gem: the component DSL, design tokens, and 53 Stimulus primitives poetry-ui is built on - the same public surface you use to build your own component library, styled with Tailwind utilities or a stable BEM class contract.

poetry-core is the engine gem: subclass `Poetry::Core::Component` and declare the whole public surface at class level - `style :variant, default:, variants:, doc:` for visual axes (closed vocabularies become inclusion validations and registry facts), `option :count, :integer` for typed attributes, `renders_one`/`renders_many` slots documented with `slot_doc`, `part` for the DOM-verified anatomy contract, and `use_stimulus` to wire the 53 shipped Stimulus behavior controllers, validated against the controllers manifest at class load. A sidecar `Style` dictionary (`base`/`element`/`variant`/`compound`) maps style values to CSS classes; `css_mode :tailwind` (default) resolves Tailwind utilities through a conflict-aware merger, while `css_mode :bem` emits a stable derived class vocabulary (`my-kit-pill--variant-danger`) for bring-your-own-CSS hosts, styled against a `Poetry::Core::CSS::BemReference` skeleton whose capsule digest detects dictionary drift. Design tokens generate from one DTCG source into contrast-gated CSS custom properties, `Poetry::Core::Registry` builds the committed machine-readable index from introspection, and `Poetry::Core::Check` lints consumer ERB against it statically (`bin/rails poetry:check`, the MCP `check` tool).
