Skip to content

Options with icons with single select #253

Answered by csandman
alexnguyennz asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for the super late reply, just started a new job and I've been very busy!

This isn't that hard if you make a custom SingleValue component (in the same way the example you linked does the MultiValue):

const customComponents = {
  Option: ({ children, ...props }) => (
    <chakraComponents.Option {...props}>
      <Icon
        as={props.data.Icon}
        color={props.data.iconColor}
        mr={2}
        h={5}
        w={5}
      />
      {children}
    </chakraComponents.Option>
  ),
  SingleValue: ({ children, ...props }) => (
    <chakraComponents.SingleValue {...props}>
      <Flex align="center">
        <Icon
          as={props.data.Icon}
          color={props.data.iconColor}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alexnguyennz
Comment options

@csandman
Comment options

Answer selected by alexnguyennz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants