mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
docs(code-snippet): add examples for dynnamic, hidden code snippets
This commit is contained in:
parent
0f6d42eb42
commit
5e13f04e3c
3 changed files with 67 additions and 0 deletions
15
docs/src/pages/framed/CodeSnippet/DynamicCodeSnippet.svelte
Normal file
15
docs/src/pages/framed/CodeSnippet/DynamicCodeSnippet.svelte
Normal file
|
@ -0,0 +1,15 @@
|
|||
<script>
|
||||
import { ToggleSmall, CodeSnippet } from "carbon-components-svelte";
|
||||
|
||||
let toggled = false;
|
||||
|
||||
$: length = toggled ? 20 : 10;
|
||||
$: code = Array.from({ length }, (_, i) => i + 1).join("\n");
|
||||
</script>
|
||||
|
||||
<ToggleSmall
|
||||
style="margin-bottom: var(--cds-spacing-05)"
|
||||
labelText="Trigger snippet overflow"
|
||||
bind:toggled
|
||||
/>
|
||||
<CodeSnippet type="multi" code="{code}" />
|
Loading…
Add table
Add a link
Reference in a new issue