Code Block
A component for displaying formatted code snippets with syntax highlighting.
Props
Prop | Type | Default | Description |
|---|---|---|---|
code | string | required | A string containing the code to be displayed. |
language | string | undefined | An optional string that specifies the programming language (e.g., javascript, typescript, svelte). |
variant | string | '' | Custom CSS classes to apply custom styling variants. |
overrideDefaultStyling | boolean | false | If true, prevents the component from applying its default styling. |
Samples
Here is an example of the CodeBlock component.
0
<script lang="ts">1
import CodeBlock from 'fluid-ui-svelte/components/CodeBlock.svelte';2
</script>3
4
<CodeBlock language="typescript" code="console.log('Hello, Fluid UI!');" />