react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Enable/Disable tooltip during mouseover/mouseout

Open saravananksivanathan opened this issue 10 years ago • 22 comments

Great work on react-select!!!

I would like have an option via props to enable/disable tooltip during mouseover/mouseout. This would help to display additional info about the option a user is about to select.

I'll be happy to contribute via PR please share your thoughts and help me get started.

saravananksivanathan avatar Jan 29 '16 15:01 saravananksivanathan

+1

devlato avatar Aug 04 '16 15:08 devlato

It's an awesome tool and Tooltip is indeed important in some cases +1

Abzoozy avatar Aug 16 '16 11:08 Abzoozy

Tooltip would indeed be very useful +1

pgoldweic avatar Feb 03 '17 17:02 pgoldweic

+1

jaredramirez avatar Feb 08 '17 23:02 jaredramirez

Could we have a tooltip when you hover over the input area as well as when you hover over the elements in the drop down? Use case: The text in the elements wraps to multiple lines because it is too long, but at least you can see it. When you select one of these, you get '...' where it is truncated, so it is no longer possible to see the full text unless you open the dropdown again and scroll to the selected element

freeranger avatar Mar 16 '17 14:03 freeranger

+1

rubensbiork avatar Mar 29 '17 15:03 rubensbiork

+1

blairmorris avatar May 24 '17 18:05 blairmorris

Could be useful to display error messages as well (errors returned from backend for example).

piotrpawlik avatar Jun 07 '17 10:06 piotrpawlik

+1

KozhevnikovDmitry avatar Oct 12 '17 09:10 KozhevnikovDmitry

Dear all, for now you can do it like this

     <div className="col-md-2" title={this.state.dataDesc}>
                 <Select
                          placeholder="Select data"
                          options={this.state.dataList}
                          value={this.state.dataDesc}
                          clearable={true}
                   />
      </div>

this works fine for me :)

BhavikModi avatar Jan 05 '18 12:01 BhavikModi

+1

robertomellocampos avatar Apr 20 '18 18:04 robertomellocampos

We were able to use optionRenderer to achieve this.

shakdwipeea avatar Apr 26 '18 11:04 shakdwipeea

Hi @shakdwipeea Can you please share the code , how you have achieved the same using optionRenderer. When i am trying to do so option hover has stopped working for me. This is my function body

renderOption(op){
return (
		    <div key={op.key} className="VirtualizedSelectOption" style={op.style} onClick={() => op.selectValue(op.option)}>
					{op.option[op.labelKey]}
				</div>
  		);
}

jainvizz avatar May 16 '18 09:05 jainvizz

We did sth along the lines of the following:

<Select labelKey="name"
	valueKey="id"
	placeholder=""
	closeOnSelect={false}
	multi={true}
	options={options}
	onChange={(e) => this.handleMultiChange(e, formElement.id)}
	value={this.state.personForm.role.value}
	onClose={this.closedMenu}
	optionRenderer={(option) =>
	<div onMouseEnter={(e) => this.showToolTipRole(e, option)}
	     onMouseLeave={this.hideToolTipRole}
	     data-tip
	     data-for={index}
	     oldtitle="Update Person">
	     {option.name}
	</div>
	}
	removeSelected={false}
/>

Note that you will need to define your state transition functions (eg. showToolTipRole, hideToolTipRole etc.)

shakdwipeea avatar May 16 '18 11:05 shakdwipeea

Thanks @shakdwipeea for a quick response. I figured out that I was not setting focus class on mouse over. added the event to do that and it started working for me. Code provided below.

renderOption(op){
return (
		    <div key={op.key} className={["VirtualizedSelectOption", op.focusedOption[op.valueKey] === op.option[op.valueKey] ? "VirtualizedSelectFocusedOption" : ""].join(" ")} style={op.style} onMouseOver={() => op.focusOption(op.option)} onClick={() => op.selectValue(op.option)}>
					{op.option[op.labelKey]}
				</div>
  		);
}

jainvizz avatar May 16 '18 11:05 jainvizz

@saravanansivanathan

Please see the following example example by react-select

Sawan1994 avatar Sep 28 '18 11:09 Sawan1994

+1

robyn-thomas avatar Sep 04 '19 09:09 robyn-thomas

Could we have a tooltip when you hover over the input area as well as when you hover over the elements in the drop down? Use case: The text in the elements wraps to multiple lines because it is too long, but at least you can see it. When you select one of these, you get '...' where it is truncated, so it is no longer possible to see the full text unless you open the dropdown again and scroll to the selected element

This is so important

robyn-thomas avatar Sep 04 '19 11:09 robyn-thomas

+1

presiyan-kostov avatar Jan 10 '20 16:01 presiyan-kostov

Not sure if this is the best place for my issue, but will post here

I was able to get tooltip working by using SingleValue components and wrapping it with a tooltip, my only problem is the tooltip doesn't show when my select menu is disabled

https://codesandbox.io/s/condescending-agnesi-p3ypc

If you look at this sandbox you will see the tooltip when you select an option and hover over it. Now if you set isDisabled={true} on the CreatableSelect you will notice that the tooltip no longer shows over the selected singleValue option. Is there a way to still have the tooltip show even though the select isDisabled?

hect1c avatar Apr 01 '20 11:04 hect1c