c2n Web Components

v1.0.32
io.github.code2nguyen/c2n Checked 4 hours ago Published 8 days ago

Exact APIs, examples, theme tokens and markup validation for the c2n (c2-*) Lit web components.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_components List components

Lists every c2n component (tag, package, category, one-line description, installed version in the current project).

ParameterTypeDescription
categorystringOnly this category
formatstringOutput format
installedOnlybooleanOnly packages installed in the current project
keywordstringSubstring filter on tag, title or description

get_component Get component API

Full API of one component: install/import lines, attributes, script-only properties (renderers, data sources) and methods, slots, events, native CSS parts, CSS variables grouped by semantic target and state (with the theme token each follows), composition and preset names. A long answer is shortened to fit one response and says how to ask for the rest; pass `include` for one section in full. Examples are served by get_examples.

ParameterTypeDescription
tag *stringComponent tag, id or package: `c2-button`, `button`, `@c2n/button`, `c2-tab`, or a concrete icon tag such as `c2-feather-arrow-right`
formatstringOutput format
includearraySections to include (default: all)

search_components Search components

Free-text search across component names, descriptions, intents (what each component is for), attributes, slots, events, example labels and, for a query about icons or one that is an icon name, icon names. Use it to find the component for a UI need, worded as a requirement or a widget name ("let users turn a setting on or off", "dropdown", "avatar with status", "arrow icon").

ParameterTypeDescription
query *stringWhat you are looking for
limitinteger

get_examples Get examples

Markup examples of a component: usage rows from the docs, styled gallery cards (the looks shown on the docs site, each with a summary of what it changes and light/dark screenshots) and the landing preview. Start with `view: "index"` to see every look on one page, then fetch the chosen card by its slug.

ParameterTypeDescription
tag *stringComponent tag, id or package: `c2-button`, `button`, `@c2n/button`, `c2-tab`, or a concrete icon tag such as `c2-feather-arrow-right`
formatstringOutput format
kindstringOnly this kind
labelstringSubstring filter on the example label, or a gallery slug from the index
limitinteger
offsetinteger
querystringSearch label, section, description, use case, accessibility note and component tags
sectionstringGallery section filter (e.g. "Variants", "Sizes")
viewstring`index`: one line per example (label, slug, summary, screenshot), no code and no paging; `full`: markup and CSS

search_examples Search gallery looks

Search every component's gallery for a look or a use case ("compact", "glass", "pill", "danger", "underline input", "KPI"): returns matching cards across components with their summary and screenshot. Fetch one with get_examples `label: <slug>`.

ParameterTypeDescription
query *stringThe look or situation you want
limitinteger
tagstringLimit to one component

get_presets Get presets

Curated presets of a component ("inspiration" looks): base markup plus each preset as CSS variable values and attributes.

ParameterTypeDescription
tag *stringComponent tag, id or package: `c2-button`, `button`, `@c2n/button`, `c2-tab`, or a concrete icon tag such as `c2-feather-arrow-right`
formatstringOutput format
namestringSubstring filter on the preset name

get_theme Get theme tokens

The @c2n/theme design tokens (--c2-theme--*) with light/dark defaults, how to install and map your own tokens, and dark mode. With `tag`: which of that component's variables follow which token.

ParameterTypeDescription
formatstringOutput format
tagstringComponent tag, id or package: `c2-button`, `button`, `@c2n/button`, `c2-tab`, or a concrete icon tag such as `c2-feather-arrow-right`

generate_variant Generate a variant component

Turns CSS variable / attribute overrides of a component into copy-paste code: a CSS class, HTML + <style>, a Lit subclass registered under your own tag, or JSON. Validates variable and attribute names against the component API. Start from a curated preset with `preset`, or from a gallery card with `example` (its slug or label).

ParameterTypeDescription
name *stringClass / tag name of the variant (kebab-case, must contain a hyphen, not c2-*)
tag *stringComponent tag, id or package: `c2-button`, `button`, `@c2n/button`, `c2-tab`, or a concrete icon tag such as `c2-feather-arrow-right`
attributesobjectAttributes to fix, e.g. {"running": "true"}
cssobjectComponent CSS variables to fix, e.g. {"--c2-button__container--background-color": "var(--c2-theme--color-error)"}
examplestringGallery card to start from, by slug or label (get_examples view: index): its themed variables for this component are merged under `css`
formatstring
htmlstringBase markup; defaults to the example or preset markup, else `<tag>Label</tag>`
presetstringName of a curated preset to start from (its values are merged under `css`)

validate_markup Validate markup

Checks HTML, JSX, Vue, Svelte, Astro, Angular or Lit markup and CSS you wrote against the installed c2n API: native controls a c2-* element replaces (<button>, <input>, <select>, <textarea>, <dialog>, <details>, <progress>), unknown c2-* tags, attributes, slots, events and --c2-* variables (with "did you mean"), and box styling on a c2-* host. Lists the imports that register the elements used. Call it on every file you write before finishing.

ParameterTypeDescription
code *stringThe source to check: a component file, a template, a stylesheet or a snippet
filenamestringFile name, which sets how the source is read (`App.tsx`: JSX props; `styles.css`: a stylesheet). Always pass it; without it the source is read as HTML
formatstringOutput format

report_issue Draft a component issue

Drafts a GitHub issue about c2n met while building an app: a component bug, something documented that does not work, a missing feature or component, an API that made the common case hard, a mismatch between get_component and the behaviour, or a workaround you had to write (plain HTML instead of a c2-* element, a CSS or timing hack). Fills in the installed version and the framework, checks the reproduction with validate_markup, looks for existing issues that name the component (only its tag is sent to GitHub), and returns the draft plus a link that opens the pre-filled issue form. It never subm…

ParameterTypeDescription
actual *stringWhat happened instead
building *stringWhat the developer was building, in a sentence, without private details
component *stringThe element or package the problem is in: `c2-table`, `table` or `@c2n/table`
expected *stringWhat should have happened
kind *string`bug`: wrong behaviour; `gap`: documented or implied but missing; `feature`: a capability or component c2n does not have; `papercut`: works, but the common case is hard; `docs`: the docs or an MCP ans…
title *stringOne line naming the problem, e.g. "renderCell node does not fill the cell"
formatstringOutput format
reprostringThe smallest markup, CSS or script that shows it (checked with validate_markup)
reproFilenamestringFile name that sets how the reproduction is read (`repro.tsx`, `repro.css`); HTML by default
searchExistingbooleanSearch GitHub for existing issues that name this component (sends only the component's tag; needs network access)
workaroundstringWhat was done instead, if anything

get_workflow_guide Get workflow guide

The c2n application workflow guides: `workflow` (theme once, use tags, name what repeats), `theming`, `variant-components`, `frameworks` (plain HTML, Lit, Astro, React, Vue, SSR).

ParameterTypeDescription
topicstring