2024-12-18 12:41:00 +00:00
|
|
|
<script type="module" src="https://md-block.verou.me/md-block.js"></script>
|
|
|
|
|
2024-12-17 17:36:02 +00:00
|
|
|
<script type="module">
|
2024-12-18 12:41:00 +00:00
|
|
|
import {BetterSelect} from "./src/BetterSelect.js"
|
2024-12-17 17:36:02 +00:00
|
|
|
|
|
|
|
customElements.define("better-select", BetterSelect)
|
|
|
|
</script>
|
|
|
|
|
2024-12-18 12:41:00 +00:00
|
|
|
<link rel="stylesheet" href="src/BetterSelect.css">
|
2024-12-17 17:36:02 +00:00
|
|
|
<style>
|
2024-12-18 12:41:00 +00:00
|
|
|
@import
|
|
|
|
url('https://cdn.jsdelivr.net/gh/darkwiiplayer/css@main/all.css')
|
|
|
|
layer(framework);
|
|
|
|
@import
|
|
|
|
url('https://cdn.jsdelivr.net/gh/darkwiiplayer/css@main/schemes/talia.css')
|
|
|
|
layer(theme);
|
|
|
|
|
2024-12-18 14:40:19 +00:00
|
|
|
:root {
|
|
|
|
--color: #4af;
|
|
|
|
}
|
|
|
|
|
2024-12-18 12:41:00 +00:00
|
|
|
better-select {
|
2024-12-18 14:40:19 +00:00
|
|
|
background: var(--background);
|
|
|
|
|
|
|
|
&::part(search) {
|
|
|
|
border-radius: 3px;
|
|
|
|
border: 1px solid var(--color);
|
|
|
|
}
|
|
|
|
&::part(search):focus {
|
|
|
|
outline: 2px solid color-mix(in hsl, var(--color), transparent 60%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
outline: 2px solid var(--color);
|
|
|
|
}
|
|
|
|
&:state(--open) {
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
&::part(item):focus {
|
|
|
|
color: var(--color);
|
|
|
|
background-color: color-mix(in hsl, var(--color), transparent 80%);
|
|
|
|
}
|
2024-12-17 17:36:02 +00:00
|
|
|
}
|
2024-12-18 12:41:00 +00:00
|
|
|
|
|
|
|
md-block:not([rendered]) { display: none }
|
2024-12-17 17:36:02 +00:00
|
|
|
</style>
|
|
|
|
|
2024-12-18 12:41:00 +00:00
|
|
|
<main class="content-width">
|
|
|
|
<h1>Better Select</h1>
|
|
|
|
|
|
|
|
<p>A better muli-option input box for HTML</p>
|
|
|
|
|
2024-12-19 14:46:58 +00:00
|
|
|
<better-select name="better-selection" class="search">
|
|
|
|
<span slot="placeholder">Placeholder...</span>
|
|
|
|
<option value="first">First value</option>
|
|
|
|
<option value="second">Second value</option>
|
|
|
|
<option value="third">Third value</option>
|
|
|
|
</better-select>
|
2024-12-18 12:41:00 +00:00
|
|
|
|
2024-12-19 14:46:58 +00:00
|
|
|
<details>
|
2024-12-19 14:45:12 +00:00
|
|
|
<summary>More examples</summary>
|
2024-12-19 14:46:58 +00:00
|
|
|
<form onsubmit='event.preventDefault(); console.table(Object.fromEntries(new FormData(document.querySelector("form")).entries()))'>
|
2024-12-19 14:45:12 +00:00
|
|
|
<label>
|
|
|
|
<span>No Search</span>
|
|
|
|
<better-select>
|
|
|
|
<span slot="placeholder">Placeholder...</span>
|
|
|
|
<option value="first">First value</option>
|
|
|
|
<option value="second">Second value</option>
|
|
|
|
<option value="third">Third value</option>
|
|
|
|
</better-select>
|
|
|
|
</label>
|
|
|
|
<label>
|
|
|
|
<span>No Placeholder</span>
|
|
|
|
<better-select>
|
|
|
|
<option value="first">First value</option>
|
|
|
|
<option value="second">Second value</option>
|
|
|
|
<option value="third">Third value</option>
|
|
|
|
</better-select>
|
|
|
|
</label>
|
|
|
|
<label>
|
|
|
|
<span>Pre-Selected Option</span>
|
|
|
|
<better-select>
|
|
|
|
<option value="first">First value</option>
|
|
|
|
<option value="second" selected>Second value</option>
|
|
|
|
<option value="third">Third value</option>
|
|
|
|
</better-select>
|
|
|
|
</label>
|
2024-12-19 14:46:58 +00:00
|
|
|
<button title="Log form data to dev console">Submit</button>
|
|
|
|
<p>Submit the form to have its form values printed to the dev console.</p>
|
2024-12-19 14:45:12 +00:00
|
|
|
</form>
|
|
|
|
</details>
|
|
|
|
|
2024-12-18 12:41:00 +00:00
|
|
|
<vertical-spacer triple></vertical-spacer>
|
|
|
|
|
|
|
|
<md-block src="readme.md">
|
|
|
|
</md-block>
|
|
|
|
</main>
|