Expandable Container
Expandable shows and hides information to create a focused experience.
Component Type
Container
Platform
Web
Component
Sana Canvas
Delivery Channels
Web
Version
16.1.7Experience Surfaces
Page Body Inline
Anatomy

- Chevron Icon: This is part of the header to indicate the opened or closed state of the container. This icon could be placed on the left or right side of the header. When the chevron is on the left of the Title, it shows Chevron Right for ‘collapsed’ and Chevron Down for ‘expanded.’ When the chevron is on the right of the Title, it shows Chevron Down for ‘collapsed’ and Chevron Up for ‘expanded.’
- Avatar Indicator (Optional): This is used to display a user photo for containers that are user related. If there is no user photo available, it shows the default user icon.
- Title: The heading text for the information being shown in the content section.
- Content Section: This section is where users can find more information and details about the container’s subject.
Usage Guidance
- This component highlights the most important details of a section and reveals more when a user taps or clicks on the header part of the container.
- Enabling users to hide and show information ensures the design remains focused and relevant to their expectations.
- Scanning through the most critical information first makes processing more efficient without compromising the ability to access additional information.
When to Use
Use an Expandable Container when there is a lot of information to be shown on a page, but some details can initially be hidden from view.
When to Use Something Else
Be cautious of hiding critical information or burdening the user with an extra click if they are likely to read all the content. There is a chance that content hidden within the collapsed state will not be read or immediately noticed by users.
Design Annotations Needed
- Specify the heading level for the Expandable Container title
Examples
Start Icon
For a basic expandable container with a chevron icon before the title, place Expandable.Icon
before Expandable.Title as children of Expandable.Target and pass the iconPosition prop to
Expandable.Icon with a value of start. Expandable.Icon will use a right chevron icon when
collapsed and a down chevron icon when expanded.
import {Expandable} from '@workday/canvas-kit-react/expandable';
export default () => (
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Icon iconPosition="start" />
<Expandable.Title>Title</Expandable.Title>
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
);
End Icon
For an expandable container with a chevron icon after the title, place Expandable.Title before
Expandable.Icon as children of Expandable.Target and pass the iconPosition prop to
Expandable.Icon with a value of end. Expandable.Icon will use a down chevron icon when
collapsed and an up chevron icon when expanded.
import {Expandable} from '@workday/canvas-kit-react/expandable';
export default () => (
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Title>
This is a really long title that should wrap to multiple lines
</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
);
With Avatar
To include an avatar image, Expandable.Avatar should be placed between Expandable.Icon and
Expandable.Title. An iconPosition prop with a value of either start or end should be passed
to Expandable.Icon depending on whether the Expandable.Icon is placed before or after
Expandable.Title.
Note: If using an avatar image, do not also include an Icon component in addition to the Expandable.Icon. This component is meant to have either an avatar image or an icon in addition to the Expandable.Icon, or neither an avatar image nor an extra icon.
import {Expandable} from '@workday/canvas-kit-react/expandable';
// @ts-ignore: Cannot find module error
import testAvatar from './test-avatar.png';
export default () => (
<div>
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Icon iconPosition="start" />
<Expandable.Avatar name="Avatar" url={testAvatar} />
<Expandable.Title>Title</Expandable.Title>
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Avatar name="Avatar" url={testAvatar} />
<Expandable.Title>Title</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
</div>
);
Right to Left (RTL)
Expandable container has bidirectional support and should function as expected with RTL languages as long as the content direction is set in your Canvas theme.
import {CanvasProvider} from '@workday/canvas-kit-react/common';
import {Expandable} from '@workday/canvas-kit-react/expandable';
export default () => {
return (
<CanvasProvider dir="rtl">
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Icon iconPosition="start" />
<Expandable.Avatar name="Avatar" />
<Expandable.Title>Title</Expandable.Title>
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Avatar name="Avatar" />
<Expandable.Title>Title</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
</CanvasProvider>
);
};
Depth
The depth prop passed to Expandable allows you to adjust the visual elevation of a component
using our depth tokens.
import {Expandable} from '@workday/canvas-kit-react/expandable';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const expandableStyles = createStyles({
boxShadow: system.depth[3],
borderRadius: system.shape.lg,
padding: system.padding.xs,
margin: system.gap.xs,
});
export default () => {
return (
<Expandable cs={expandableStyles}>
<Expandable.Target headingLevel="h4">
<Expandable.Title>Additional Information</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content>This Expandable Container has a depth of 3.</Expandable.Content>
</Expandable>
);
};
Title Wrap
Long titles will wrap to the next line and increase the height of the container.
import {Expandable} from '@workday/canvas-kit-react/expandable';
// @ts-ignore: Cannot find module error
import testAvatar from './test-avatar.png';
export default () => (
<Expandable>
<Expandable.Target headingLevel="h4">
<Expandable.Icon iconPosition="start" />
<Expandable.Avatar name="Avatar" url={testAvatar} />
<Expandable.Title>
Our house special supreme pizza includes pepperoni, sausage, bell peppers, mushrooms,
onions, and oregano.
</Expandable.Title>
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>
);
Hoisted Model
If you need direct access to the model, you can hoist it with the useExpandableModel hook. In the
example below, we’re hoisting the models to expand and collapse all three containers at once.
- The state of a component being open or closed must be conveyed to assistive technologies.
- A Button must be used as the control to toggle the display of any content.
- If there are multiple toggle Buttons on the same page, provide additional information in their labels to make them uniquely distinguishable to a screen reader.
- Do not change the toggle Button label to convey state. An exception to this would be a scenario where a visual hint text is decoupled from both the state and the label for a control so the hint text is not announced by assistive technologies.
- Avoid keyboard traps when adding components to the accordion panel. For example, the user expands an accordion, but is unable to tab to the next focusable element.
- Hidden content must be hidden correctly from keyboard, screen reader, and touch interaction.
- Changing the label of something to indicate its state will not always be accounted for in live time for a screen reader user. For example, a play button should have a non-changing, persistent label and the state (pressed or unpressed) is conveyed visually as well as to assistive technology once the state is changed.
import {SecondaryButton} from '@workday/canvas-kit-react/button';
import {useUniqueId} from '@workday/canvas-kit-react/common';
import {Expandable, useExpandableModel} from '@workday/canvas-kit-react/expandable';
import {Flex} from '@workday/canvas-kit-react/layout';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const listStyles = createStyles({
flexDirection: 'column',
gap: system.gap.sm,
padding: '0',
marginInline: system.padding.md,
marginBlock: '0',
});
export default () => {
const modelOne = useExpandableModel();
const modelTwo = useExpandableModel();
const modelThree = useExpandableModel();
const idOne = useUniqueId();
const idTwo = useUniqueId();
const idThree = useUniqueId();
const handleExpandAll = () => {
modelOne.events.show();
modelTwo.events.show();
modelThree.events.show();
};
const handleCollapseAll = () => {
modelOne.events.hide();
modelTwo.events.hide();
modelThree.events.hide();
};
return (
<Flex cs={{gap: system.gap.lg, flexDirection: 'column'}}>
<Flex cs={{gap: system.gap.md}}>
<SecondaryButton onClick={handleExpandAll}>Expand All</SecondaryButton>
<SecondaryButton onClick={handleCollapseAll}>Collapse All</SecondaryButton>
</Flex>
<Flex cs={{flexDirection: 'column'}}>
<Expandable model={modelOne}>
<Expandable.Target headingLevel="h4">
<Expandable.Title id={idOne}>Usage Guidance</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content as="section" aria-labelledby={idOne}>
This component highlights the most important details of a section and reveals more when
a user taps or clicks on the header part of the container. Enabling users to hide and
show information ensures the design remains focused and relevant to their expectations.
Scanning through the most critical information first makes processing more efficient
without compromising the ability to access additional information.
</Expandable.Content>
</Expandable>
<Expandable model={modelTwo}>
<Expandable.Target headingLevel="h4">
<Expandable.Title id={idTwo}>Accessibility Guidelines</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content as="section" aria-labelledby={idTwo}>
<Flex as="ul" cs={listStyles}>
<li>
The state of a component being open or closed must be conveyed to assistive
technologies.
</li>
<li>A Button must be used as the control to toggle the display of any content.</li>
<li>
If there are multiple toggle Buttons on the same page, provide additional
information in their labels to make them uniquely distinguishable to a screen
reader.
</li>
<li>
Do not change the toggle Button label to convey state. An exception to this would be
a scenario where a visual hint text is decoupled from both the state and the label
for a control so the hint text is not announced by assistive technologies.
</li>
<li>
Avoid keyboard traps when adding components to the accordion panel. For example, the
user expands an accordion, but is unable to tab to the next focusable element.
</li>
<li>
Hidden content must be hidden correctly from keyboard, screen reader, and touch
interaction.
</li>
<li>
Changing the label of something to indicate its state will not always be accounted
for in live time for a screen reader user. For example, a play button should have a
non-changing, persistent label and the state (pressed or unpressed) is conveyed
visually as well as to assistive technology once the state is changed.
</li>
</Flex>
</Expandable.Content>
</Expandable>
<Expandable model={modelThree}>
<Expandable.Target headingLevel="h4">
<Expandable.Title id={idThree}>Content Guidelines</Expandable.Title>
<Expandable.Icon iconPosition="end" />
</Expandable.Target>
<Expandable.Content as="section" aria-labelledby={idThree}>
Titles should be short and concise, yet long enough to explain what the user would
expect to see when the content is expanded. If titles must be long, make sure it doesn't
wrap more than two lines.
</Expandable.Content>
</Expandable>
</Flex>
</Flex>
);
};
For the accordion composition (named regions on each panel), see Accessibility Requirements.
Accessibility
Ensure users of assistive technology can find the control, understand whether related content is
shown or hidden, and reveal or hide that content from the keyboard. Expandable is an inline
disclosure (show/hide) widget: a button
toggles content that stays in the document flow.
Use Expandable for show/hide sections in the page. Compose multiple instances to build an
accordion — see
Hoisted Model. For a navigation accordion, see
Side Panel with Navigation .
Minimum Accessible Structure
The following matches the Start Icon example layout: Expandable.Icon before
Expandable.Title inside Expandable.Target, then Expandable.Content.
headingLevel is omitted here on purpose — add it only after asking which level matches the
page outline (see Accessibility Requirements). The Basic Example code uses headingLevel="h4"
as a sample, not a default.
import {Expandable} from '@workday/canvas-kit-react/expandable';
<Expandable>
<Expandable.Target>
<Expandable.Icon iconPosition="start" />
<Expandable.Title>Title</Expandable.Title>
</Expandable.Target>
<Expandable.Content>Content</Expandable.Content>
</Expandable>;Built-in Behaviors
Canvas Kit applies these automatically via useExpandableModel (a DisclosureModel) and Expandable
subcomponents. Do not duplicate them in consuming code.
ARIA and DOM (applied by hooks/subcomponents):
Expandable.Target: native<button>witharia-expanded(truewhenvisibility !== 'hidden') andaria-controlsset to the disclosureid.onClicktogglesevents.show()/events.hide().headingLevel: when set ('h1'–'h6'), wraps the button inHeadingrendered as that heading element. When omitted, the button is not wrapped in a heading.Expandable.Content:idset to the same disclosureid. Collapsed content stays in the DOM withdisplay: none(not unmounted). Default element is a<div>.Expandable.Title: styled<div>for the visible name. It does not receive anidfrom the model.Expandable.Icon: decorative chevron that rotates fromvisibility. Expanded/collapsed state for assistive technology comes fromaria-expanded, not from the icon.Expandable.Avatar:isDecorative={true}by default so the image is hidden from assistive technology when paired withExpandable.Title.- Disclosure
id: generated withuseUniqueIdunless you passidtouseExpandableModel. DefaultinitialVisibilityis'hidden'.
Keyboard (native button behavior):
Expandable.Target uses native <button> keyboard behavior (tab order, Enter /
Space to toggle). Collapsed content is not in the tab order (display: none). Focus
stays on the button; Canvas Kit does not move focus into Expandable.Content.
Screen reader expectations (when built-in behaviors are used as intended):
- On focus, assistive technology announces the title text, the button role, and expanded/collapsed
state from
aria-expanded(for example, “Title, button, collapsed”) - Activating the button announces the updated expanded/collapsed state from
aria-expanded - While collapsed, content is removed from the accessibility tree (
display: none) - While expanded, content follows the button in reading order
- When
headingLevelis set, heading navigation includes the heading that wraps the button - When
Expandable.Content as="section"is used witharia-labelledbypointing atExpandable.Title, region/landmark navigation can name each open section
Accessibility Requirements
Required in application code for an accessible Expandable. Hoist useExpandableModel when you
need programmatic show/hide (for example, expand all) or a stable disclosure id. Rows marked
(conditional) apply only when the situation matches—otherwise omit.
If no design spec is provided: use the single disclosure composition
(Basic Example). If the spec is several related headers, use the accordion
composition. Omit Expandable.Avatar, initialVisibility, and a custom id.
Choose a composition (pick one; Expandable.Content as="section" and as="ul" are
mutually exclusive):
- Single disclosure — one show/hide section. Basic Example /
Minimum Accessible Structure. Default Content is a
<div>. - Accordion — several related headers. Hoisted Model: unique
idonExpandable.Title,Expandable.Content as="section"witharia-labelledby. - Navigation list — disclosed links.
Side Panel with Navigation :
as="ul", omitheadingLevel.
Heading level: Ask which heading (h1–h6) belongs in the document outline before setting
headingLevel. Omit headingLevel for navigation. Do not generate headingLevel by
default — the Basic Example code uses h4 only as a sample.
| Requirement | How to satisfy |
|---|---|
| Accessible name | Non-empty Expandable.Title inside Expandable.Target. |
| Keyboard-operable toggle | Expandable.Target (native <button>). |
| Visual expanded/collapsed indicator | Expandable.Icon with iconPosition matching layout (start or end). |
| Heading in the document outline (conditional) | headingLevel on Expandable.Target when the control titles body content (single disclosure or accordion). Omit headingLevel for the navigation-list composition. Ask which level. |
| Accordion named regions (conditional) | Accordion composition: Expandable.Content as="section" plus aria-labelledby referencing a unique id on Expandable.Title. |
| List markup (conditional) | Navigation-list composition: Expandable.Content as="ul" (and list items as children). |
| Decorative avatar (conditional) | Expandable.Avatar when the design includes an avatar. Keep isDecorative at the default true. |
| Start expanded (conditional) | initialVisibility: 'visible' on useExpandableModel (or the equivalent model config). |
| Programmatic expand/collapse (conditional) | Hoist useExpandableModel and call model.events.show() / model.events.hide(). |
Summary for code generation:
- REQUIRED:
Expandable.Target, non-emptyExpandable.Title,Expandable.Content,Expandable.Icon - CONDITIONAL: composition (single disclosure vs accordion vs navigation list),
headingLevel(ask which; omit for navigation), accordionas="section"+aria-labelledby, navigationas="ul",Expandable.Avatar, hoisteduseExpandableModel,initialVisibility
Anti-Patterns
Do not generate code that does the following (see Accessibility Requirements above for what to supply instead):
- Manually set
aria-expanded,aria-controls, or the disclosureidonExpandable.TargetorExpandable.Content—useExpandableTargetanduseExpandableContentwire these - Rely on
Expandable.IconorExpandable.Avatarfor the accessible name — useExpandable.Title - Override
Expandable.Targetwith a customas—Expandable.Targetalready renders a native<button> - Set
idonExpandableto identify the outer wrapper —idis model config and is forwarded to the container element, whileExpandable.Contentalso usesstate.id, which can produce duplicate IDs. For a stable contentid, hoistuseExpandableModel({id: '…'}).Expandable.Titlestill needs its ownidwhen you setaria-labelledbyonExpandable.Content - Wrap
Expandable.Targetin your own heading — useheadingLevelinstead - Default
headingLeveltoh4(or any level) without asking, or setheadingLevelon navigation disclosures - Generate several Basic Example disclosures with default
divContent when the spec is an accordion — use the accordion composition (see Choose a composition) - Set
as="section"andas="ul"on the sameExpandable.Content— pick one composition - Change
Expandable.Titleto encode state (for example “Collapsed” / “Expanded” or “Show” / “Hide”) —aria-expandedalready exposes state - Unmount
Expandable.Contentwhen collapsed, or addaria-hiddenon it — the library usesdisplay: none - Set
isDecorative={false}onExpandable.Avatarby default, or pair an avatar with an extra non-chevron icon - Use
open,expanded, oronToggleprops onExpandable— visibility isinitialVisibilityplususeExpandableModelevents - Assume default
Expandable.Contentis a landmark region — that is only true withas="section"
Component API
Expandable
Expandable wraps an Expandable.Target and an Expandable.Content. By default, it provides a
DisclosureModel for its subcomponents. Alternatively, a model may be passed in using the
hoisted model pattern.
Layout Component
Expandable supports all props from thelayout component.
Props
Props extend from div. Changing the as prop will change the element interface.
Props extend from . If a model is passed, props from ExpandableModelConfig are ignored.
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The children of the | |
cs | | The | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | div |
ref | React.Ref<R = div> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If | |
model | | Optional model to pass to the component. This will override the default model created for the component. This can be useful if you want to access to the state and events of the model, or if you have nested components of the same type and you need to override the model provided by React Context. | |
elemPropsHook | ( | Optional hook that receives the model and all props to be applied to the element. If you use this, it is your responsibility to return props, merging as appropriate. For example, returning an empty object will disable all elemProps hooks associated with this component. This allows finer control over a component without creating a new one. |
Expandable.Target
Expandable.Target creates a heading and a button. The heading is a semantic heading to
describe the associated content. The button provides users the ability to toggle the
associated content.
As according to the W3 disclosure
specification, the button has
aria-expanded and aria-controls attributes set by default
This component should hold an Expandable.Icon, an optional Expandable.Avatar, and an
Expandable.Title.
Layout Component
Expandable.Target supports all props from thelayout component.
Props
Props extend from button. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | Children of the | |
headingLevel | | This specifies the semantic heading level that will wrap the | |
cs | | The | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | button |
ref | React.Ref<R = button> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If | |
model | | Optional model to pass to the component. This will override the default model created for the component. This can be useful if you want to access to the state and events of the model, or if you have nested components of the same type and you need to override the model provided by React Context. | |
elemPropsHook | ( | Optional hook that receives the model and all props to be applied to the element. If you use this, it is your responsibility to return props, merging as appropriate. For example, returning an empty object will disable all elemProps hooks associated with this component. This allows finer control over a component without creating a new one. |
useExpandableTarget
(
model: ,
elemProps: {},
ref: React.Ref
) => {
aria-controls: string;
aria-expanded: boolean;
onClick: (event: ) => void;
}Expandable.Title
Expandable.Title styles the target text that describes the content.
Layout Component
Expandable.Title supports all props from thelayout component.
Props
Props extend from div. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | Children of the | |
cs | | The | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | div |
ref | React.Ref<R = div> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Expandable.Icon
Expandable.Icon creates an icon to visually indicate the state of the content. It takes an
iconPosition prop to determine which chevron icon to use.
Props
Props extend from span. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
icon | | Icon to display from | |
iconPosition | | Button icon positions can either be | 'start' |
size | | string | number | The size of the SystemIcon in size variants or string / numeric (px) values. System icon sizes
| |
shouldMirror | boolean | If set to | false |
shouldMirrorInRTL | boolean | If set to | false |
cs | | The | |
color | string | The color of the SystemIcon. This defines | |
accent | string | The accent color of the SystemIcon. This overrides | |
background | string | The background color of the SystemIcon. | |
children | React.ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | span |
ref | React.Ref<R = span> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If | |
model | | Optional model to pass to the component. This will override the default model created for the component. This can be useful if you want to access to the state and events of the model, or if you have nested components of the same type and you need to override the model provided by React Context. | |
elemPropsHook | ( | Optional hook that receives the model and all props to be applied to the element. If you use this, it is your responsibility to return props, merging as appropriate. For example, returning an empty object will disable all elemProps hooks associated with this component. This allows finer control over a component without creating a new one. |
Expandable.Avatar
Expandable.Avatar is an optional component that creates an Avatar to display a decorative
image.
Props
Props extend from div. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
url | string | The URL of the user's photo. For best fit, use square images. | |
objectFit | Property.ObjectFit | An objectFit property that can customize how to resize your image to fit its container. | 'contain' |
isDecorative | boolean | If true, the Avatar won't forward the | true |
children | ReactNode | Children of the BaseAvatar. | |
variant | | The variant of the Avatar. | 'blue' |
size | | The size of the Avatar.
| 'medium' |
cs | | The | |
name | string | The alt text of the Avatar image. This prop is also used for the initials. The first letter of the first name and the first letter of the second name are chosen for the initials. | '' |
preferredInitials | string | If you want full control over the initials, use | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | div |
ref | React.Ref<R = div> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Expandable.Content
Expandable.Content holds the content that will be conditionally expanded and collapsed. It
has an id to ensure the Expandable.Target properly set it to the aria-controls
attribute.
Layout Component
Expandable.Content supports all props from thelayout component.
Props
Props extend from div. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The children of the | |
cs | | The | |
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | div |
ref | React.Ref<R = div> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If | |
model | | Optional model to pass to the component. This will override the default model created for the component. This can be useful if you want to access to the state and events of the model, or if you have nested components of the same type and you need to override the model provided by React Context. | |
elemPropsHook | ( | Optional hook that receives the model and all props to be applied to the element. If you use this, it is your responsibility to return props, merging as appropriate. For example, returning an empty object will disable all elemProps hooks associated with this component. This allows finer control over a component without creating a new one. |
useExpandableContent
(
model: ,
elemProps: {},
ref: React.Ref
) => {
style: {
display: undefined;
} | {
display: string;
};
id: string;
}Model
Content Guidelines
- Titles should be short and concise, yet long enough to explain what the user would expect to see when the content is expanded.
- If titles must be long, make sure it doesn’t wrap more than two lines.