theme-ui#Radio TypeScript Examples

The following examples show how to use theme-ui#Radio. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectRepeatable.tsx    From slice-machine with Apache License 2.0 6 votes vote down vote up
SelectRepeatable: React.FC = () => {
  const [field, , helpers] = useField<boolean>("repeatable");
  return (
    <Box mb={2}>
      <FlexCard selected={field.value} onClick={() => helpers.setValue(true)}>
        <Radio checked={field.value} />
        <Box
          sx={{
            marginLeft: 2,
          }}
        >
          Repeatable type
          <Box as="p" sx={{ fontSize: "12px", color: "textClear", mt: 1 }}>
            Best for multiple instances like blog posts, authors, products...
          </Box>
        </Box>
      </FlexCard>
      <FlexCard selected={!field.value} onClick={() => helpers.setValue(false)}>
        <Radio checked={!field.value} />
        <Box
          sx={{
            marginLeft: 2,
          }}
        >
          Single type
          <Box as="p" sx={{ fontSize: "12px", color: "textClear", mt: 1 }}>
            Best for a unique page, like the homepage or privacy policy page...
          </Box>
        </Box>
      </FlexCard>
    </Box>
  );
}