Root
The Root component serves as the main container for all other Suchi components, providing a context (SuchiContext) for them.
It tracks all sections and references, using this information to generate the index and the list of references.
Props
Prop | Type | Default |
---|---|---|
children | ReactNode | - |
className | string | "" |
style | CSSProperties | {} |
accentColor | string | #ff4f18 |
toggleWidth | number | 768 |
observerControls | IntersectionObserverInit | - |
scrollBehaviorControls | ScrollIntoViewOptions | - |
accentColor
The Root component accepts an accentColor
prop, which is used to highlight the active Indicator and active Item.
Mastering React Hooks
Introduction
Getting Started
Advanced Techniques
Best Practices
Conclusion
For more information on how to style your Suchi Index, refer to the Styling Guide.
observerControls and scrollBehaviorControls
You can controls the behavior of the Intersection Observer using the observerControls
and the Scroll Behavior using the scrollBehaviorControls
For example:
toggleWidth
You can use the toggleWidth
property to dynamically switch between rendering the DesktopIndex and the MobileIndex components based on the screen size.
By default, the value of toggleWidth is set to 768px. Here's how it works:
- If the screen size is less than 768px, the MobileIndex component will be displayed.
- If the screen size is 768px or greater, the DesktopIndex component will be displayed. This allows you to provide a responsive experience by adapting the rendered component based on the user's screen size.
toggleWidth = 400px
Mobile Index