Comments (6)
@claviska but both sl-select
and sl-select multiple
should behave the same inside the flex container and they are not.
from shoelace.
The control is designed so the listbox is the same width as the "text field" that displays the selection. In most cases, this is desirable. In your case, the control is so small you can't even see the label.
If you really want controls that small, you can change the size of the listbox with CSS. However, users will still have trouble viewing the selected items. 🤷🏻♂️
sl-select::part(listbox) {
min-width: min-content;
white-space: nowrap;
}
Result:
from shoelace.
Dear @claviska, thank you so much for your answer, but I'm not changing any size in any sl-select
. Select 1 and Select 2 are the default examples from the Shoelace documentation.
<div style="display: flex">
<sl-select label="Select 1" multiple clearable>
<sl-option value="option-1">Option 1</sl-option>
<sl-option value="option-2">Option 2</sl-option>
</sl-select>
<sl-select label="Select 2" clearable>
<sl-option value="option-1">Option 1</sl-option>
<sl-option value="option-2">Option 2</sl-option>
</sl-select>
</div>
If you remove the value
from the sl-select
with the multiple
attribute, it doesn't work as expected. We cannot see options : (
<sl-select label="Select 1" multiple clearable>
If you remove the value
from the sl-select
without the multiple
attribute, it works as expected.
<sl-select label="Select 2" clearable>
Example here.
Sorry If if I didn't explain myself well enough before, I don't know, maybe I'm missing something.
Thank you so much for your time.
from shoelace.
The display: flex
container is causing the sizing issue. If you need it as a flex child, either set an explicit width or an appropriate flex.
https://jsfiddle.net/oL2u581q/
from shoelace.
But why it's needed extra CSS or change component just for sl-select
with the multiple
attribute. Is that behavior made on propose for something? I'm using FF and Chromium based browsers.
With normal sl-select
you don't need to change / add anything, it simple works.
https://jsfiddle.net/fuk3p9nv/1/
from shoelace.
Because you’re overriding the default display (and thus size) by putting it into a flex container.
from shoelace.
Related Issues (20)
- `<sl-menu>` safe triangle is always visible
- SlTabGroup twitching in Safari(110% or 130% zoom) HOT 4
- Form and form control memory leak HOT 7
- Dark mode broken with shadow DOM - `:root` specifier is missing in `dark.css` HOT 3
- Switching between first and second slide does not work correctly in `<sl-carousel>` HOT 1
- label instead of legend in the radio-group HOT 1
- sl-checkbox emits sl-changed event before dom is updated HOT 3
- sl-select does not close when clicking outside HOT 2
- 2.13.0 automatically installs `playwright` when used as a dependency HOT 6
- <sl-tooltip> adds a space when used inline HOT 2
- [v2.13.0] sl-select component shows HTML source code when selecting an option containing HTML HOT 1
- Type Error: Illegal Constructor thrown at runtime when instantiating Shoelace components by constructor HOT 2
- Checkbox Component: Coloring mandatory field indication ("*")
- Strange behaviour with SlSelect in a Drawer or a Dialog : it triggers parent event SlHide and SlShow
- Carousel pagination not synced with active item when prefer-reduced-motion HOT 3
- Tab components breaking after mounting HOT 2
- sl-checkbox with no value attribute has value of 'undefined' when checked HOT 3
- Misalignment of some components HOT 1
- sl-dialog causes layout shift as of 2.13 HOT 2
- sl-checkbox has no applied styles for the help-text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shoelace.