Component prop disabled
October 15, 2022 · View on GitHub
Prop disabled used in component Switch、Checkbox
Usage
import { Checkbox } from 'lvlgjs-ui'
import { useState } from 'react'
function Component () {
const [value, setValue] = useState(false)
return (
<React.Fragment>
{/* controlled */}
<Checkbox
style={style.checkbox}
onChange={(e) => setValue(e.checked)}
checked={value}
text={"商品A"}
/>
{/* not controlled */}
<Checkbox
style={style.checkbox}
onChange={(e) => console.log(e.checked)}
text={"商品B"}
disabled={true}
checked={true}
/>
</React.Fragment>
)
}
const style = {
checkbox: {},
}