Subcomponent
Move one member of a component family into its own sibling doc without duplicating it in the parent.Choose a separate doc
Start with a component family doc. Move one public member into a sibling doc when it has its own source and enough behavior, props, or usage guidance to maintain separately. The parent still lists the member, but only by name.
- Keep a small member inline when its whole contract stays clear in the family doc.
- Use a sibling doc when the member needs focused search results, examples, usage guidance, or independent maintenance.
- Give each member one documentation owner. Do not keep a full parent entry and a sibling doc for the same name.
Reference it from the parent
components/AcmeDialog.doc.mjs
javascript/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */export default {type: 'component',name: 'AcmeDialog',displayName: 'Acme Dialog',usage: {description: 'Presents a focused task above the current page.'},components: [{name: 'AcmeDialog',displayName: 'Acme Dialog',description: 'Owns the modal surface and open state.',props: [],},{name: 'AcmeDialogHeader'},],};
The name-only entry keeps AcmeDialogHeader in the family. Its description and props come only from the sibling file.
Write the subcomponent doc
components/AcmeDialogHeader.doc.mjs
javascript/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */export default {type: 'component',name: 'AcmeDialogHeader',displayName: 'Acme Dialog Header',subComponentOf: 'AcmeDialog',description: 'Labels an Acme Dialog and holds its close action.',props: [{name: 'title',type: 'string',description: 'The dialog title.',required: true,},],};
| Field | Type | Required | Description |
|---|---|---|---|
| subComponentOf | string | no | SubComponentDoc variant (required there): the parent component's name (e.g. 'Chat'). Marks this file as a sub-component doc that inherits family fields (group, category, keywords, theming, playground) from the parent. |
| description | string | no | SubComponentDoc variant (required there): one-sentence description of the sub-component's role within the parent composition. Single/Multi docs have no top-level description; they derive their summary from usage. |
| props | ComponentPropDoc[] | no | SingleComponentDoc variant (required there): all public props for the one primary component. Each prop is {name, type, description, default?, required?, slotElements?}. Skip styling props like xstyle/className/style. Also present on SubComponentDoc. |
From ComponentDoc: astryx docs authoring component-doc
subComponentOfmust exactly match the parent doc'sname.descriptionexplains this member's role in the family.usageis optional; add it when the member needs guidance beyond that sentence.- The child inherits family fields such as
group,category,keywords,theming, andplaygroundunless it overrides them.