Disclosure
This component allows you to show/hide content within a collapsible container.
The client:load
attribute is required for the component to work because the component uses Javascript for interactivity.
To use the component, the page must be in .mdx
format. Change the format from .md
to .mdx
if necessary. All your existing markdown will still be supported without issue.
Usage
Import the Disclosure
component like so:
Use the <Disclosure>
component within your content like so:
You can nest the Disclosure component with the built-in Starlight <Tabs>
component. This is helpful when displaying multiple related code snippets.
Working examples
Simple hidden text
Just some text that does not need to be seen on first load
Combination of disclosures, tabs, and code blocks
- Open Terminal.
- Change the current working directory to where you want to clone repo.
- Type
git clone
. - Paste the following URL, then press Enter.