PHP Classes

File: src/components/inputs/SwitchInput.stories.tsx

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   WordPress React Plugin Kit   src/components/inputs/SwitchInput.stories.tsx   Download  
File: src/components/inputs/SwitchInput.stories.tsx
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: WordPress React Plugin Kit
Environment to develop new WordPress plugins
Author: By
Last change:
Date: 1 year ago
Size: 519 bytes
 

Contents

Class file image Download
import { useState } from '@wordpress/element'; import { ComponentMeta } from '@storybook/react'; import Input from './Input'; export default { title: 'Common/Input/SwitchInput', component: Input, } as ComponentMeta<typeof Input>; export const SwitchInput = () => { const [switchActive, setSwitchAActive] = useState(false); return ( <Input type="switch" value={switchActive ? '1' : '0'} onChange={() => setSwitchAActive(!switchActive)} /> ); };