Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

docs(SideNavCollapseButton): the collapsible prop lists every key of the config it takes (#10282)

Cindy Zhang79817bfeb20f
diff --git a/.changeset/sidenav-collapse-button-config-docs.md b/.changeset/sidenav-collapse-button-config-docs.md
new file mode 100644
index 0000000000..4b88ac6056
--- /dev/null
+++ b/.changeset/sidenav-collapse-button-config-docs.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[docs] SideNavCollapseButton's docs now list every key its `collapsible` prop takes: the whole controlled config SideNav gets, not only `isCollapsed` and `onCollapsedChange`.
+
+@cixzhang
diff --git a/packages/core/src/SideNav/SideNavCollapseButton.doc.mjs b/packages/core/src/SideNav/SideNavCollapseButton.doc.mjs
index 23d7d35c13..fdcca7f1ec 100644
--- a/packages/core/src/SideNav/SideNavCollapseButton.doc.mjs
+++ b/packages/core/src/SideNav/SideNavCollapseButton.doc.mjs
@@ -19,8 +19,8 @@ export const docs = {
props: [
{
name: 'collapsible',
- type: '{isCollapsed: boolean, onCollapsedChange: (isCollapsed: boolean) => void}',
- description: 'The same controlled collapsible config passed to SideNav. Only needed when the button is rendered outside the sidenav, where collapse context cannot reach it.',
+ type: '{isCollapsed: boolean, onCollapsedChange: (isCollapsed: boolean) => void, defaultIsCollapsed?: boolean, hasButton?: boolean, buttonLabel?: string}',
+ description: 'The same controlled collapsible config passed to SideNav, with all its keys. Only needed when the button is rendered outside the sidenav, where collapse context cannot reach it.',
},
{
name: 'handleRef',
@@ -53,8 +53,8 @@ export const docsZh = {
props: [
{
name: 'collapsible',
- type: '{isCollapsed: boolean, onCollapsedChange: (isCollapsed: boolean) => void}',
- description: '与 SideNav 相同的受控 collapsible 配置。仅在按钮渲染在侧边栏外部、无法读取折叠上下文时需要。',
+ type: '{isCollapsed: boolean, onCollapsedChange: (isCollapsed: boolean) => void, defaultIsCollapsed?: boolean, hasButton?: boolean, buttonLabel?: string}',
+ description: '与 SideNav 相同的受控 collapsible 配置,包含其全部键。仅在按钮渲染在侧边栏外部、无法读取折叠上下文时需要。',
},
{
name: 'handleRef',
@@ -85,7 +85,7 @@ export const docsDense = {
displayName: 'Side Nav Collapse Button',
description: 'Toggle button for sidenav collapse. Place inside SideNav (reads context) or outside (pass the same controlled collapsible config both get). Icon-only ghost button by default.',
propDescriptions: {
- collapsible: 'Controlled collapsible config, same object SideNav gets. Only needed when button rendered outside sidenav.',
+ collapsible: 'Controlled collapsible config, same object SideNav gets, all keys allowed. Only needed when button rendered outside sidenav.',
handleRef: 'Deprecated. Pass collapsible instead.',
label: 'Custom label. Text button w/ chevron when provided, icon-only when omitted.',
size: "Button size. Inherits from the container ('sm' in a SideNav footer), else 'md'.",
diff --git a/packages/core/src/SideNav/SideNavCollapseButton.tsx b/packages/core/src/SideNav/SideNavCollapseButton.tsx
index 3f1ccdaede..d4951cbe7b 100644
--- a/packages/core/src/SideNav/SideNavCollapseButton.tsx
+++ b/packages/core/src/SideNav/SideNavCollapseButton.tsx
@@ -77,9 +77,10 @@ const styles = stylex.create({
export interface SideNavCollapseButtonProps extends BaseProps<HTMLButtonElement> {
ref?: React.Ref<HTMLButtonElement>;
/**
- * The same controlled `collapsible` config given to SideNav
- * (`{isCollapsed, onCollapsedChange}`). Needed only when the button is
- * rendered outside the sidenav, where collapse context cannot reach it.
+ * The same controlled `collapsible` config given to SideNav, with all its
+ * keys (`isCollapsed` and `onCollapsedChange` are required). Needed only
+ * when the button is rendered outside the sidenav, where collapse context
+ * cannot reach it.
*/
collapsible?: SideNavControlledCollapsible;