Icon Badge
Squared icon containers in outline, solid, and subtle variants for feature lists and empty states.
123456789101112import { IconBadge } from "#components/ui/ui-sdk/icon-badge.tsx";import { indigoPalette } from "@stylexblocks/ui/themes/palettes.ts";
export function Example() { return ( {/* variant + size props resolve through the StyleX recipe and are exposed as data-variant / data-size attributes */} <IconBadge variant="subtle" size="md" palette={indigoPalette}> <SparkIcon /> </IconBadge> );}Variants
Sizes
Install
1npx stylexblocks add icon-badgeSource
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677import * as stylex from "@stylexjs/stylex";import { createComponent } from "#lib/ui-sdk/create-component.tsx";import { defineRecipe } from "#lib/recipe-props.ts";import { colorPalette } from '@stylexblocks/ui/color-palette.stylex.ts'import { colors } from '@stylexblocks/ui/tokens/colors.stylex.ts'import { semanticRadii } from '@stylexblocks/ui/semantic-tokens/radii.stylex.ts'import { sizes } from '@stylexblocks/ui/tokens/sizes.stylex.ts'
const iconBadgeStyles = stylex.create({ base: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', },})
const iconBadgeVariants = stylex.create({ outline: { borderWidth: '1px', borderColor: colorPalette.subtle, color: colorPalette.fg, }, solid: { backgroundColor: colorPalette.solid, color: colors.white, }, subtle: { backgroundColor: colorPalette.subtle, color: colorPalette.fg, },})
const iconBadgeSizes = stylex.create({ sm: { borderRadius: semanticRadii.control, fontSize: '0.9em', width: sizes.controlXs, height: sizes.controlXs, }, md: { borderRadius: semanticRadii.control, fontSize: '1.1em', width: sizes.controlMd, height: sizes.controlMd, }, lg: { borderRadius: semanticRadii.control, fontSize: '1.3em', width: sizes.controlLg, height: sizes.controlLg, }, xl: { borderRadius: semanticRadii.control, fontSize: '1.5em', width: sizes.controlXl, height: sizes.controlXl, },})
export type IconBadgeVariant = keyof typeof iconBadgeVariants
export type IconBadgeSize = keyof typeof iconBadgeSizes
/** * IconBadge — recipe and component colocated in one file. Variant/size props * resolve mechanically from the axis maps. Composition via `render`. */const iconBadgeRecipe = defineRecipe({ styles: iconBadgeStyles, axes: { variant: iconBadgeVariants, size: iconBadgeSizes }, defaultVariants: { variant: "outline", size: "md" },});
export const IconBadge = createComponent("span", iconBadgeRecipe, "IconBadge");
export type IconBadgeProps = React.ComponentProps<typeof IconBadge>;
Examples
Installable blocks built with Icon Badge — real use cases, delivered as source you own.
Studio project inquiry form with response-time status, three value-proposition cards, validated contact and scope fields, multi-select topic toggles, team-size and budget selects, referral attribution, and a structured submission confirmation view.
Developer documentation hub featuring a searchable hero banner, CLI starter panel, quick-start cards, filterable categorized guide tracks with schematic previews, interactive article preview dialog with copyable code blocks, and live status and changelog links.
Sequential technical quickstart guide featuring breadcrumb navigation, an AI setup prompt card, prerequisites and troubleshooting callouts, synced package-manager and runtime code switchers, checkable step completion progress, onward reading cards, and a responsive sticky table-of-contents rail.
Centered workspace sign-in card with inline field validation, password visibility toggle, remember-device persistence, Google, GitHub, and passkey provider buttons, and toast feedback.
Two-pane desktop preferences modal with a categorized navigation rail, keyboard-navigable live settings search, responsive container-query collapse, accent swatch and scale controls, connected app toggles, shortcut bindings, quota progress meters, and a docked dirty-state save bar.
Multi-section workspace settings layout with grouped sidebar navigation, responsive mobile tabs, a sticky dirty-state save bar, API token management, session controls, and team billing quotas.