Code
Code is part of the Layout and content group. Inline code token for technical prose.
Installation
Section titled “Installation”npx bambiui add code --framework reactnpx bambiui add code --framework solidnpx bambiui add code --framework sveltenpx bambiui add code --framework vueimport { Code } from "@/components/ui/code";
export function Example() { return <Code />;}import { Code } from "~/components/ui/code";
export function Example() { return <Code />;}<script lang="ts"> import { Code } from "$lib/components/ui/code";</script>
<Code /><script setup lang="ts">import { Code } from "@/components/ui/code";</script>
<template> <Code /></template>Preview
Section titled “Preview”
Code preview should be verified in the target framework after copying the component source. Interactive behavior comes from generated public artifacts, not docs-only mock behavior.
Behavior
Section titled “Behavior”Use for props, commands, token names, and file paths inside text.
Generated output uses serializable data-* attributes for state and styling. Controlled components fire bambi:<event-name> events and expect application state to update externally; uncontrolled components manage local source state and still fire events.
Accessibility
Section titled “Accessibility”Use semantic labels, visible focus states, and keyboard interaction patterns appropriate for Code. Do not hide required instructions in transient UI. Verify focus movement and disabled states in the installed framework output.
Exports
Section titled “Exports”CodeTokens
Section titled “Tokens”Customize tokens after installing and previewing the component. Relevant tokens include:
--bambi-background--bambi-foreground--bambi-border