chakra-datepicker icon indicating copy to clipboard operation
chakra-datepicker copied to clipboard

Feature: Custom PopoverTrigger

Open iamclaytonray opened this issue 2 years ago • 1 comments

Could we allow a custom PopoverTrigger? If the prop isn't passed in, it defaults to the current input. Example code:

export const Example = () => <DatePicker value={new Date()} popoverTrigger={() => <Button>New Date</Button>} />

I can submit a PR today. The code changes should be as simple as wrapping the current trigger with a conditional. Example:

<PopoverTrigger>
  {popoverTrigger ? (
    {popoverTrigger?.()}
  ) : (
    <Input
      size="lg"
      value={value}
      onFocus={onFocus}
      onChange={onChange}
    />
  )}
</PopoverTrigger>

iamclaytonray avatar Oct 29 '21 13:10 iamclaytonray