Marks text to signify a short fragment of computer code.
<Code>console.log()</Code>
This component is based on the code
element and supports common margin props.
Use the size
prop to control text size. This prop also provides correct line height and corrective letter spacing—as text size increases, the relative line height and letter spacing decrease.
<Flex direction="column" gap="3" align="start">
<Code size="9">console.log()</Code>
<Code size="8">console.log()</Code>
<Code size="7">console.log()</Code>
<Code size="6">console.log()</Code>
<Code size="5">console.log()</Code>
<Code size="4">console.log()</Code>
<Code size="3">console.log()</Code>
<Code size="2">console.log()</Code>
<Code size="1">console.log()</Code>
</Flex>
Use the variant
prop to control the visual style.
<Flex direction="column" align="start" gap="2">
<Code variant="solid">console.log()</Code>
<Code variant="soft">console.log()</Code>
<Code variant="outline">console.log()</Code>
<Code variant="ghost">console.log()</Code>
</Flex>
Use the color
prop to assign a specific color, ignoring the global theme.
<Flex direction="column" align="start" gap="2">
<Code color="indigo" variant="soft">
console.log()
</Code>
<Code color="crimson" variant="soft">
console.log()
</Code>
<Code color="cyan" variant="soft">
console.log()
</Code>
<Code color="orange" variant="soft">
console.log()
</Code>
</Flex>
Use the highContrast
prop to add additional contrast.
<Flex gap="3">
<Flex direction="column" align="start" gap="2">
<Code variant="solid">console.log()</Code>
<Code variant="soft">console.log()</Code>
<Code variant="outline">console.log()</Code>
<Code variant="ghost">console.log()</Code>
</Flex>
<Flex direction="column" align="start" gap="2">
<Code variant="solid" highContrast>
console.log()
</Code>
<Code variant="soft" highContrast>
console.log()
</Code>
<Code variant="outline" highContrast>
console.log()
</Code>
<Code variant="ghost" highContrast>
console.log()
</Code>
</Flex>
</Flex>
Use the weight
prop to set the text weight.
<Flex direction="column" gap="2" align="start">
<Code weight="regular">console.log()</Code>
<Code weight="bold">console.log()</Code>
</Flex>