@@ -49,6 +49,39 @@ By default, the Accordion is oriented vertically. Use the `orientation` prop to
4949
5050<Example id = " horizontal" />
5151
52+ ### Using the Root Provider
53+
54+ The ` RootProvider ` component provides a context for the accordion. It accepts the value of the ` useAccordion ` hook. You
55+ can leverage it to access the component state and methods from outside the accordion.
56+
57+ <Example id = " root-provider" />
58+
59+ > If you're using the ` RootProvider ` component, you don't need to use the ` Root ` component.
60+
61+ ### Accessing context
62+
63+ Use the ` Accordion.Context ` component or ` useAccordionContext ` hook to access the state of an accordion. It exposes the
64+ following properties:
65+
66+ - ` focusedValue ` : The value of the focused accordion item.
67+ - ` value ` : The value of the selected accordion items.
68+ - ` setValue ` : A method to set the selected accordion items.
69+
70+ <Example id = " context" />
71+
72+ ### Accessing the item context
73+
74+ Use the ` Accordion.ItemContext ` component or ` useAccordionItemContext ` hook to access the state of an accordion item. It
75+ exposes the following properties:
76+
77+ - ` expanded ` : Whether the accordion item is expanded.
78+ - ` focused ` : Whether the accordion item is focused.
79+ - ` disabled ` : Whether the accordion item is disabled.
80+
81+ <Example id = " item-context" />
82+
83+ ## Guides
84+
5285### Animate Content Size
5386
5487Use the ` --height ` and/or ` --width ` CSS variables to animate the size of the content when it expands or closes:
@@ -85,37 +118,6 @@ Use the `--height` and/or `--width` CSS variables to animate the size of the con
85118}
86119```
87120
88- ### Using the Root Provider
89-
90- The ` RootProvider ` component provides a context for the accordion. It accepts the value of the ` useAccordion ` hook. You
91- can leverage it to access the component state and methods from outside the accordion.
92-
93- <Example id = " root-provider" />
94-
95- > If you're using the ` RootProvider ` component, you don't need to use the ` Root ` component.
96-
97- ### Accessing context
98-
99- Use the ` Accordion.Context ` component or ` useAccordionContext ` hook to access the state of an accordion. It exposes the
100- following properties:
101-
102- - ` focusedValue ` : The value of the focused accordion item.
103- - ` value ` : The value of the selected accordion items.
104- - ` setValue ` : A method to set the selected accordion items.
105-
106- <Example id = " context" />
107-
108- ### Accessing the item context
109-
110- Use the ` Accordion.ItemContext ` component or ` useAccordionItemContext ` hook to access the state of an accordion item. It
111- exposes the following properties:
112-
113- - ` expanded ` : Whether the accordion item is expanded.
114- - ` focused ` : Whether the accordion item is focused.
115- - ` disabled ` : Whether the accordion item is disabled.
116-
117- <Example id = " item-context" />
118-
119121## API Reference
120122
121123### Props
0 commit comments