Custom Select with radio buttons as options - reactjs

I need to do this in a React component:
I tried to hide/show a div, but the problem is to set a click listener on the whole page to hide the div, and it seems to be wrong.
I'm also using Formik, but I can't find the way to customize the select Field to have this kind of look.
How is the best way to approach this?

You can use an onBlur event to hide this div, instead of setting an event listener for the whole page.

Related

Next JS Custom Select dropdown icon on click does not trigger the options to display

I am new to Next JS and I have a custom select menu dropdown with an array of options. The select has an arrow icon that I included by using css psudo ::after with background image. When the user clicks the icon(svg), the dropdown is not triggered and I am not sure how to make this work.
I have tried using useRef and setting it to the component then on button click I tried to use ref.current.click() which doesnt trigger the drop down.
I also tried including the arrow icon inside the component rather than use CSS but this was unsuccessful as well.
Can someone please advise me how to make this functionality work? Thank you in advance for any help, it is much appreciated.

Handling focus with react-select

I'm trying to figure out how to work around what appears to be greedy-focus issues with react-select.
I'm using custom components in my MenuList component that need the focus to work (rc-slider). Basically, I'd like the select to support an additional value for each option and I'm using a Slider to do that.
The issue with the sliders is that I can click on them to change the value, but can't drag the handles, as the Select seems to take back the focus (and even close the drop-down if menuIsOpen is not controlled).
The select does need to re-render when the values change, but I can't figure out why the focus has to change.
https://codesandbox.io/s/epic-moon-cv33b

Change button labels for AngularUi Bootstrap's datepicker

I need to change the Today, Clear and Close button's label. I'm looking for something like the clear-text, close-text and current-text options for the datepickerPopup directive or for a good alternative workaround.
Tried to change with Jquery, but the buttons don't have unique class or id, so I cannot create a unique selector for each button.

How to trigger Angular-Strap modal with event other than click event?

Angular Strap V2's modal seems to have lost some functionality of V1, and I'm struggling to work out how to achieve what was fairly straightforward with V1 (using angular-strap's $modal service).
The documentation only shows an example where the modal is attached to a DOM element like a button and seems to be automatically wired to the click event. However I want to use other events eg SwipeLeft is a common convention for deleting something, but I'd like to pop up an "Are you sure?" modal prompt for this action. Is this possible?
Is there any way to use the V2 modal with any event other than the click event?
Looking at the source code, it looks like you can bind your own events, or use the default click event.
It should work if you add a data-trigger='myEvent' to your markup.
https://github.com/mgcrea/angular-strap/blob/master/src/modal/modal.js#L279

Angular Bootstrap: How to show a popover based on a child elements' trigger?

Demo Fiddle
I'd like to show some help text using a popover for the entire group of fields, not for each individual input.
In the fiddle, I'm simply using a mouseenter trigger to show how it should look like, but what I really want is to trigger it on focus for any input, but have the popover be positioned based on the parent element.
In non-angular land, I'd trigger a custom event (say groupenter) when any one of the fields is in focus, and have the popover listen to that event. I'd also debounce the corresponding groupleave event so the popover won't flicker as I tab around the inputs.
What's an angular-y way to accomplish that here?
(I think this patch helps, but it just got committed days ago)
Got it working!
I had to fork tooltip.js to add 'groupenter': 'groupleave' to triggerMap since there's no public api to add to the map.

Resources