ink-checkbox
Version:
Checkbox component for Ink
38 lines • 1.55 kB
JavaScript
import React, { useState } from 'react';
import { render, Box, Text } from 'ink';
import { Checkbox } from '../source/index.js';
import { preparePlayground } from '../source/utils.js';
import BigText from 'ink-big-text';
preparePlayground();
const StyleExample = () => {
const [checked, setChecked] = useState(false);
return (React.createElement(Box, { flexDirection: "column", margin: 1 },
React.createElement(BigText, { text: "Demo: Events", font: "tiny", colors: ['blue'] }),
React.createElement(Checkbox, { label: "Checkbox", focused: true, onChanged: ({ checked }) => setChecked(checked), styles: {
icon: {
checked: 'star',
focused: 'star',
normal: 'star',
},
color: {
bullet: {
checked: 'green',
focused: 'white',
normal: 'gray',
},
label: {
checked: 'green',
focused: 'white',
normal: 'gray',
},
},
}, wrapperStyles: {
marginBottom: 2,
} }),
React.createElement(Box, { flexDirection: "column", marginTop: 1 },
React.createElement(Text, { color: "green" },
"Changed value: ",
String(checked)))));
};
render(React.createElement(StyleExample, null));
//# sourceMappingURL=style.js.map