Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 709 Bytes

Toggle.md

File metadata and controls

30 lines (22 loc) · 709 Bytes

Toggle

import { Toggle } from 'renex';

// Toggle boolean by default
<Toggle>
  {(isDark, toggle) => { /* ... */ }}
</Toggle>


// Toggle between given options
<Toggle options={['light','dark']}>
  {(theme, toggle) => { /* ... */ }}
</Toggle>


// If you need more control on the data type
<Toggle options={['light','dark'] as const}>
  {/* ... */}
</Toggle>

Props

Name Type Default Description
as string Fragment HTML tag to render.
initial string number boolean
onValueChange (value: string number boolean):void