Required parts
An Accordion without its panel or a Dialog without its title rarely throws. It renders, silently broken or inaccessible. Declare the parts once and every call site is checked.
12345{ "rules": { "systomic/required-parts": "error" }}See the difference
<AccordionItem><AccordionTrigger /></AccordionItem>Yes. Your plan stays active until the end of the billing period.
Within 14 days of purchase, no questions asked.
Teams of three or more get shared billing and roles.
<AccordionItem><AccordionTrigger /><AccordionPanel /></AccordionItem>What doesn't work
1 finding1234567891011import { Accordion, AccordionItem, AccordionTrigger } from "@/design-system/accordion";
export function Faq() { return ( <Accordion> <AccordionItem> <AccordionTrigger>Can I cancel anytime?</AccordionTrigger> </AccordionItem> </Accordion> );}systomic/required-parts <Accordion> is missing AccordionPanel. Render every required part, as in the component's full example.
What works
No findings123456789101112131415161718192021import { Accordion, AccordionItem, AccordionPanel, AccordionTrigger } from "@/design-system/accordion";
const faqs = [{ id: "cancel", question: "Can I cancel anytime?", answer: "Yes, from the billing page." }];
export function Faq() { return ( <Accordion> {faqs.map((faq) => ( <AccordionItem key={faq.id}> <AccordionTrigger>{faq.question}</AccordionTrigger> <AccordionPanel>{faq.answer}</AccordionPanel> </AccordionItem> ))} </Accordion> );}
/** Wrappers that pass children through aren't checked. */export function FaqList({ children }: { children?: unknown }) { return <Accordion>{children}</Accordion>;}Details
Composable components (Accordion, Dialog, Tabs, Select, …) only work when every required part is rendered. A missing AccordionPanel or DialogTitle often doesn’t fail at all; it just silently renders something broken or inaccessible.
12345<Accordion> // reported: missing `AccordionPanel` <AccordionItem> <AccordionTrigger>Can I cancel anytime?</AccordionTrigger> </AccordionItem></Accordion>
<Accordion>is missingAccordionPanel. Render every required part, as in the component’s full example.
Nothing is checked until you declare the parts, either on the component or in the config.
On the component (works across files and packages, like @systomic-allow):
12345678/** * @systomic-parts AccordionItem AccordionTrigger AccordionPanel */export function Accordion(props: AccordionProps) {}
/** `|` lists alternatives: one of them is enough. *//** @systomic-parts DialogContent|DialogPopup DialogTitle */export function Dialog(props: DialogProps) {}In the config (for components you don’t own):
1234567"systomic/required-parts": ["error", { "parts": { "Accordion": ["AccordionItem", "AccordionTrigger", "AccordionPanel"], "Dialog": [["DialogContent", "DialogPopup"]], // nested array: one of them "Select.Root": ["Select.Trigger", "Select.Content"] }}]Where the parts can be:
- Anywhere below the component, including inside
map, conditions and fragments. - In a component rendered inside it:
<Accordion><FaqItem /></Accordion>is fine whenFaqItemrenders the item, trigger and panel. Local and imported components are followed two levels deep. - Under another local name:
import { AccordionItem as Item }counts asAccordionItem.
Not reported, because the content can’t be seen:
{children},{props.children},{renderItems()}, a variable holding JSX, and props that usually carry elements (items,content,slots,sections, …).<Accordion {...props} />andchildren={…}.
| Option | Default |
|---|---|
parts |
{} |
Inspired by complete-composition from Outtrue by Jakub Krehel.