Skip to content

Component API

apps/docs/src/content/docs/components/api Click to copy
Copied! apps/docs/src/content/docs/components/api

All WC-2026 components follow consistent API conventions for predictable usage and Drupal integration.

TypeConventionExample
Tag namewc- prefix, kebab-casewc-card, wc-button
PropertiescamelCasevariant, disabled
Attributeskebab-case (auto-reflected)variant, disabled
Eventswc- prefixwc-click, wc-change
CSS Partskebab-casecontainer, header-text
CSS Custom Properties--wc- prefix--wc-card-padding
Slotskebab-caseheader, actions

Components accept these standard property types:

// String enum (reflected as attribute)
@property({ type: String, reflect: true })
variant: 'default' | 'primary' | 'secondary' = 'default';
// Boolean (reflected as attribute)
@property({ type: Boolean, reflect: true })
disabled = false;
// Number
@property({ type: Number })
count = 0;
// Complex objects (NOT reflected)
@property({ attribute: false })
items: ItemData[] = [];

All custom events follow this pattern:

this.dispatchEvent(new CustomEvent('wc-change', {
detail: { value: this.value },
bubbles: true,
composed: true,
}));

The API is documented via Custom Elements Manifest (CEM), which serves as the single source of truth for Storybook args, IDE autocomplete, and documentation.

See the Pre-Planning: Component Architecture for the complete API specification.