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

It doesnt work with floating inputs

Open hightowertech opened this issue 2 years ago • 7 comments
trafficstars

Describe the bug Bootstrap 5 has floating inputs, tomselect doesnt seem to recognize them.

To Reproduce Create an example on JSFiddle, CodePen or similar service and outline the steps for reproducing the bug.

  1. use the tomselect bootstrap 5 css
  2. make a form-floating select tag https://getbootstrap.com/docs/5.3/forms/floating-labels/#example

Expected behavior at least look like a floating label https://i.imgur.com/d2m67Ht.png ^look like the select on the right side [im working on this now but i may abandon it]

hightowertech avatar Mar 30 '23 18:03 hightowertech

.ts-wrapper.form-control, .ts-wrapper.form-select {
	height:calc(3.5rem + calc(var(--bs-border-width) * 2));
    font-size: 12px;
    margin: 0 25px 0 0;
	line-height:1.25;
}

.ts-control{
padding: 1.5rem 0.25rem 0.625rem 0.25rem!important
}

this fixes it for me so far [windows10 > chrome].

i barely know how to use git and cant stop to put this in now but i will try later tonight. if its been 2 days and i didnt do it, i didnt make it and youll have to go without me lol

**this works when you're using

hightowertech avatar Mar 30 '23 19:03 hightowertech

This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Oct 23 '23 02:10 github-actions[bot]

@oyejorge It would be nice to get this implemented. bootstrap-select has this feature: https://github.com/snapappointments/bootstrap-select/pull/2784

AgentSmith0 avatar Nov 01 '23 14:11 AgentSmith0

It would be nice! Feel free to submit a pull request with an implementation.

oyejorge avatar Nov 03 '23 00:11 oyejorge

@oyejorge Hi, I don't have a PR, but I tested the following CSS which can be added, it works very well:

.form-floating .ts-control {
	padding-top: 1.625rem;
	padding-bottom: .625rem;
}
.form-floating .ts-wrapper.form-control, .form-floating .ts-wrapper.form-select {
	height: 0 !important;
}

You can try this example: https://getbootstrap.com/docs/5.3/forms/floating-labels/#example You just need to initialize the select element and it will work with the CSS.

Would be nice if you add this.

AgentSmith0 avatar Nov 03 '23 13:11 AgentSmith0

Anyone figured out how to get the label to actually shift position based on the :placeholder-shown status like Bootstrap does? My current workaround is to not care and leave the Label in the up position while using "Select a value or enter a new one" as the placeholder. Looks nice enough for me right now. YMMV based on if you accept new values.

silent-e avatar Jan 18 '24 23:01 silent-e

I can confirm @AgentSmith0 solution. I'm absolutely bad in creating PR's else I would have made one. Would be happy seeing this implemented in near future.

Nexotap avatar Mar 31 '24 15:03 Nexotap

This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Jul 30 '24 02:07 github-actions[bot]