Radio

TwebMetaRadioControl

{ label, help, choices*, metaKey* }
/**
 * @param {string} [label] - Component label.
 * @param {string} [help] - Component description.
 * @param {object} choices - Object containing key-value pairs options.
 * @param {string} metaKey - Registered meta key from register_post_meta().
 */
functions.php
register_post_meta( 'post_type_name', 'test_radio', array(
	'type'         => 'string',
	'default'      => 'choice1',
	'single'       => true,
	'show_in_rest' => true,
) );
index.js
import {
	TwebMetaRadioControl,
} from '@tigriweb/components/meta';
index.js | PanelBody
<TwebMetaRadioControl
	label={ __('Radio Label', 'your-theme-name') }
	help={ __('Radio Description', 'your-theme-name') }
	choices={ {
		'choice1': __('Choise 1', 'your-theme-name'),
		'choice2': __('Choise 2', 'your-theme-name'),
		'choice3': __('Choise 3', 'your-theme-name'),
	} }
	metaKey="test_radio"
/>

Last updated

Was this helpful?