---
title: "Radiomark · UI SDK — StyleX Blocks"
description: "The standalone circular radio indicator with a scaled center dot."
url: "https://stylexblocks.com/components/ui-sdk/radiomark/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Radiomark

The standalone circular radio indicator with a scaled center dot.

- Behavior engine: UI SDK
- Also available for: [Ark UI](https://stylexblocks.com/components/ark-ui/radiomark.md), [Base UI](https://stylexblocks.com/components/base-ui/radiomark.md)
- Category: Form
- Variants: solid, subtle, outline, inverted
- Sizes: xs, sm, md, lg
- HTML page: https://stylexblocks.com/components/ui-sdk/radiomark/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init --style ui-sdk
```

Then add the item as source you own:

```sh
npx stylexblocks add radiomark
```

Equivalent: `npx shadcn add @stylexblocks/radiomark`. Registry item JSON: https://stylexblocks.com/r/ui-sdk/radiomark.json

## Usage

```tsx
import { Radiomark } from "#components/ui/ui-sdk/radiomark.tsx";
import { indigoPalette } from "@stylexblocks/ui/themes/palettes.ts";

export function Example() {
  return (
    <>
      {/* checked by default — pass checked={false} for the empty circle */}
      <Radiomark variant="solid" size="md" palette={indigoPalette} />
      <Radiomark variant="outline" size="md" checked={false} />

      {/* composition: the render prop replaces the underlying element; as a
          function it also receives { variant, size, checked } as state */}
      <Radiomark variant="subtle" render={<li />} />
    </>
  );
}
```

## Source

`components/ui/ui-sdk/radiomark.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { mergeProps, renderElement, type PartProps } from "@ui-sdk/react/primitive";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";
import { radiomarkDotVars } from '@stylexblocks/ui/recipes/radiomark.stylex.ts'

import { colorPalette } from '@stylexblocks/ui/color-palette.stylex.ts'
import { colors } from '@stylexblocks/ui/tokens/colors.stylex.ts'
import { cursor } from '@stylexblocks/ui/tokens/cursor.stylex.ts'
import { radii } from '@stylexblocks/ui/tokens/radii.stylex.ts'
import { semanticColors } from '@stylexblocks/ui/semantic-tokens/colors.stylex.ts'
import { sizes } from '@stylexblocks/ui/tokens/sizes.stylex.ts'


const radiomarkStyles = stylex.create({
  base: {
    display: 'inline-flex',
    alignItems: 'center',
    justifyContent: 'center',
    flexShrink: 0,
    verticalAlign: 'top',
    color: colors.white,
    borderWidth: '1px',
    borderColor: {
      default: 'transparent',
      ':is([data-invalid], [aria-invalid="true"])':
        semanticColors.borderDestructive,
    },
    borderRadius: radii.full,
    cursor: {
      default: cursor.radio,
      ':is(:disabled, [disabled], [data-disabled])': cursor.disabled,
    },
    outlineWidth: {
      default: null,
      ':focus-visible': '1px',
    },
    outlineOffset: {
      default: null,
      ':focus-visible': '2px',
    },
    outlineStyle: {
      default: null,
      ':focus-visible': 'solid',
    },
    outlineColor: {
      default: null,
      ':focus-visible': colorPalette.focusRing,
    },
    opacity: {
      default: null,
      ':is(:disabled, [disabled], [data-disabled])': 0.5,
    },
    [radiomarkDotVars.height]: '100%',
    [radiomarkDotVars.width]: '100%',
    [radiomarkDotVars.borderRadius]: radii.full,
    [radiomarkDotVars.backgroundColor]: 'currentColor',
    [radiomarkDotVars.scale]: 0.4,
  },
})

const radiomarkVariants = stylex.create({
  solid: {
    borderWidth: '1px',
    borderColor: {
      default: semanticColors.border,
      ':is([data-invalid], [aria-invalid="true"])':
        semanticColors.borderDestructive,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.solid,
    },
    backgroundColor: {
      default: null,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.solid,
    },
    color: {
      default: colors.white,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.contrast,
    },
  },
  subtle: {
    borderWidth: '1px',
    backgroundColor: colorPalette.muted,
    borderColor: {
      default: colorPalette.muted,
      ':is([data-invalid], [aria-invalid="true"])':
        semanticColors.borderDestructive,
    },
    color: {
      default: 'transparent',
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.fg,
    },
  },
  outline: {
    borderWidth: '1px',
    borderColor: {
      default: 'inherit',
      ':is([data-invalid], [aria-invalid="true"])':
        semanticColors.borderDestructive,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.solid,
    },
    color: {
      default: colors.white,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.fg,
    },
    [radiomarkDotVars.scale]: 0.6,
  },
  inverted: {
    backgroundColor: semanticColors.bg,
    borderWidth: '1px',
    borderColor: {
      default: 'inherit',
      ':is([data-invalid], [aria-invalid="true"])':
        semanticColors.borderDestructive,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        'currentcolor',
    },
    color: {
      default: colors.white,
      ':is(:checked, [data-checked], [aria-checked="true"], [data-state="checked"])':
        colorPalette.solid,
    },
  },
})

const radiomarkSizes = stylex.create({
  xs: {
    width: sizes._3,
    height: sizes._3,
  },
  sm: {
    width: sizes._3_5,
    height: sizes._3_5,
  },
  md: {
    width: sizes._4,
    height: sizes._4,
  },
  lg: {
    width: sizes._5,
    height: sizes._5,
  },
})

const radiomarkDot = stylex.create({
  base: {
    height: radiomarkDotVars.height,
    width: radiomarkDotVars.width,
    borderRadius: radiomarkDotVars.borderRadius,
    backgroundColor: radiomarkDotVars.backgroundColor,
    scale: radiomarkDotVars.scale,
  },
})

export type RadiomarkVariant = keyof typeof radiomarkVariants

export type RadiomarkSize = keyof typeof radiomarkSizes

// Checked styling restated locally — the generated recipe expresses checked
// state as `:checked`, which only matches real form elements, so it is
// applied conditionally from the `checked` prop instead.
const radiomarkChecked = stylex.create({
  solid: {
    backgroundColor: colorPalette.solid,
    color: colorPalette.contrast,
    borderColor: colorPalette.solid,
  },
  subtle: { color: colorPalette.fg },
  outline: { color: colorPalette.fg, borderColor: colorPalette.solid },
  inverted: { color: colorPalette.solid, borderColor: "currentcolor" },
});

interface RadiomarkState {
  variant: RadiomarkVariant;
  size: RadiomarkSize;
  checked: boolean;
}

export interface RadiomarkProps
  extends Omit<PartProps<"span", RadiomarkState>, "style">,
    StyleOverrideProps {
  variant?: RadiomarkVariant;
  size?: RadiomarkSize;
  checked?: boolean;
}

/**
 * Radiomark — the standalone circular radio indicator with a scaled center
 * dot, composed with UI SDK's `renderElement` so it stays polymorphic via
 * `render` (a function `render` receives `{ variant, size, checked }` as
 * state).
 */
export function Radiomark({
  render,
  variant = "solid",
  size = "md",
  checked = true,
  palette,
  style,
  children,
  ...props
}: RadiomarkProps) {
  const state: RadiomarkState = { variant, size, checked };
  return renderElement(
    "span",
    mergeProps(
      {
        "aria-hidden": true,
        ...stylex.props(
          palette,
          radiomarkStyles.base,
          radiomarkVariants[variant],
          radiomarkSizes[size],
          checked && radiomarkChecked[variant],
          style,
        ),
        children: checked ? (children ?? <span {...stylex.props(radiomarkDot.base)} />) : null,
      },
      props,
    ),
    render,
    state,
  );
}
```
