Badge radius prop values
The radius prop assigns a specific border radius value to the Badge and accepts values: none, large, and full.
Radix Primitives · all subjects
11 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.
The radius prop assigns a specific border radius value to the Badge and accepts values: none, large, and full.
Example showing Badge component with three size values: ```jsx <Flex align="center" gap="2"> <Badge size="1" color="indigo">New</Badge> <Badge size="2" color="indigo">New</Badge> <Badge size="3" color="indigo">New</Badge> </Flex> ```
Example showing Badge component with four variant values: ```jsx <Flex gap="2"> <Badge variant="solid" color="indigo">New</Badge> <Badge variant="soft" color="indigo">New</Badge> <Badge variant="surface" color="indigo">New</Badge> <Badge variant="outline" color="indigo">New</Badge> </Flex> ```
Example showing Badge component with different color values: ```jsx <Flex gap="2"> <Badge color="indigo">New</Badge> <Badge color="cyan">New</Badge> <Badge color="orange">New</Badge> <Badge color="crimson">New</Badge> </Flex> ```
Example showing Badge component with different radius values: ```jsx <Flex gap="2"> <Badge variant="solid" radius="none" color="indigo">New</Badge> <Badge variant="solid" radius="large" color="indigo">New</Badge> <Badge variant="solid" radius="full" color="indigo">New</Badge> </Flex> ```
The Badge component is based on the span element and supports common margin props from the Radix Themes layout system.
The size prop controls the Badge size and accepts values: 1, 2, and 3.
The variant prop controls the visual style of the Badge and accepts four values: solid, soft, surface, and outline.
The color prop assigns a specific color to the Badge. Supported color examples include: indigo, cyan, orange, crimson, blue, green, and gray.
The highContrast prop is a boolean that increases color contrast between the Badge and the background.
Radix Themes 3.0.0 changed Badge sizes: added new size="3", made size="2" much smaller, and tweaked size="1" dimensions. Replace size="2" usage with size="3".