vwf .

API Reference

Complete API documentation for components, utilities, and framework core

Reference/API/RadioButton

RadioButton

Radio button with custom styling and optional ping effect

🔧 Props

PropertyTypeDefaultDescription
name*string-Radio group name (required for grouping)
value*string-Radio button value
labelstringundefinedDisplay text
checkedState|boolean|FunctionfalseChecked state
pingbooleanfalseAnimated ping effect on select
iconElementundefinedCustom icon element
containerClassstring-Container classes (vwfcolor, vwfsize)
onchangefunctionundefinedChange event handler

🎨 Utility Classes

PatternDescription
vwfcolor-{color}Sets radio button color
vwfsize-{size}Controls button size

💻 Examples

Radio Group

const selected = van.state('option1');
return div({class: 'space-y-4'},
  RadioButton({
    name: 'options',
    value: 'option1',
    label: 'Option 1',
    checked: () => selected.val === 'option1',
    onchange: (e) => selected.val = e.target.value
  }),
  RadioButton({
    name: 'options',
    value: 'option2',
    label: 'Option 2',
    checked: () => selected.val === 'option2',
    onchange: (e) => selected.val = e.target.value
  })
);

▶️ Live Preview

💡 Click "Edit Code" to modify the example

🔄 Click "Apply Changes" to see your modifications

↩️ Click "Reset" to restore original code

💡 Usage Tips

🔗 Related

Explore vwf

Discover what vwf can do