Skip to content

feat: allow children region to opt out of the default slot#118

Closed
amanabiy wants to merge 1 commit into
mainfrom
feat/is-children-default-tag
Closed

feat: allow children region to opt out of the default slot#118
amanabiy wants to merge 1 commit into
mainfrom
feat/is-children-default-tag

Conversation

@amanabiy

Copy link
Copy Markdown
Member

The documenter marks any children region as the default slot (isDefault: true). Consumers such as the components website use that flag to render a "(default)" label and a generic "Default slot: Specify the content as a child of the component." note in the API docs.

For some components, such as top navigation, that annotation is misleading: children may be one of several supported ways to provide content rather than the single canonical default slot. Until now there was no way to express that, since isDefault was hardcoded to region.name === 'children'.

This adds an @isChildrenDefault JSDoc tag on a region so a component can opt its children slot out of the default-slot treatment, while keeping the existing behavior for everyone who does not use the tag.

Behavior:

  • children, no tag -> isDefault: true (unchanged)
  • children + @isChildrenDefault false -> isDefault: false
  • any non-children region -> isDefault: false (unchanged)

Usage:

  export interface TopNavigationProps {
    /**
     * Specifies custom navigation content.
     * @displayname content * @isChildrenDefault false
     */
     children?: React.ReactNode;
   }

Adds the is-children-default-tag fixture and a test covering the opt-out case.

Issue #, if available: 1qZFXQh4o49s (pippin)

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The documenter marks any `children` region as the default slot
(`isDefault: true`). Consumers such as the components website use that
flag to render a "(default)" label and a generic "Default slot: Specify
the content as a child of the component." note in the API docs.

For some components that annotation is misleading: `children` may be one
of several supported ways to provide content rather than the single
canonical default slot. Until now there was no way to express that, since
`isDefault` was hardcoded to `region.name === 'children'`.

This adds an `@isChildrenDefault` JSDoc tag on a region so a component can
opt its `children` slot out of the default-slot treatment, while keeping
the existing behavior for everyone who does not use the tag.

Behavior:
- `children`, no tag                    -> isDefault: true  (unchanged)
- `children` + @isChildrenDefault false -> isDefault: false
- any non-`children` region             -> isDefault: false (unchanged)

Usage:

  export interface TopNavigationProps {
    /**
     * Specifies custom navigation content.
     * @DisplayName content
     * @isChildrenDefault false
     */
    children?: React.ReactNode;
  }

Adds the `is-children-default-tag` fixture and a test covering the opt-out case.
@amanabiy amanabiy requested a review from a team as a code owner June 18, 2026 12:01
@amanabiy amanabiy requested review from a team, NathanZlion and pan-kot and removed request for a team June 18, 2026 12:01
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.12%. Comparing base (68cacaa) to head (b07a5cc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #118   +/-   ##
=======================================
  Coverage   95.11%   95.12%           
=======================================
  Files          11       11           
  Lines         512      513    +1     
  Branches      139      140    +1     
=======================================
+ Hits          487      488    +1     
  Misses         25       25           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amanabiy amanabiy closed this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant