UNPKG

vue-search-input

Version:

A Vue.js 3 search input component, inspired by the global search input of Storybook and GitHub.

131 lines (127 loc) 3.02 kB
.search-input-wrapper { position: relative; } .search-input-wrapper input[data-search-input=true] { display: block; font-family: "Inter", system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; width: 100%; padding: 6px 30px 6px 32px; font-size: 16px; font-weight: normal; height: 38px; color: #333; background-color: #f6f9fc; border: 1px solid #f6f9fc; border-radius: 0.35rem; transition: border-color 0.15s ease-in-out; } .search-input-wrapper input[data-search-input=true]:focus { background-color: hsl(210, 50%, 122.6470588235%); border-color: #1ea7fd; outline: 0; box-shadow: none; } .search-input-wrapper .search-icon { color: rgb(131.25, 172.5, 213.75); position: absolute; } .search-input-wrapper .search-icon.search { left: 12px; bottom: 12px; box-sizing: border-box; display: block; width: 16px; height: 16px; border: 2px solid; border-radius: 100%; margin-left: -4px; margin-top: -4px; } .search-input-wrapper .search-icon.search::after { content: ""; display: block; box-sizing: border-box; position: absolute; border-radius: 3px; width: 2px; height: 7px; background: rgb(131.25, 172.5, 213.75); transform: rotate(-45deg); top: 11px; left: 12px; } .search-input-wrapper .search-icon.shortcut { width: 22px; height: 24px; cursor: text; right: 8px; bottom: 7px; background-color: rgb(230.7, 238.8, 246.9); border-radius: 3px; z-index: 50; } .search-input-wrapper .search-icon.shortcut::after { content: ""; display: block; box-sizing: border-box; position: absolute; border-radius: 2px; transform: rotate(25deg); width: 2px; height: 16px; top: 4px; left: 10px; z-index: 51; background-color: rgb(150.375, 185.25, 220.125); } .search-input-wrapper .search-icon.clear { right: 5px; bottom: 7px; cursor: pointer; z-index: 10; box-sizing: border-box; display: block; width: 24px; height: 24px; border: 2px solid transparent; border-radius: 40px; background: none; padding: 0px; outline: none; } .search-input-wrapper .search-icon.clear:focus { background: rgb(230.7, 238.8, 246.9); } .search-input-wrapper .search-icon.clear::after, .search-input-wrapper .search-icon.clear::before { content: ""; display: block; box-sizing: border-box; position: absolute; width: 16px; height: 2px; background: rgb(131.25, 172.5, 213.75); transform: rotate(45deg); border-radius: 5px; top: 9px; left: 2px; } .search-input-wrapper .search-icon.clear::after { transform: rotate(-45deg); } /* Fix the X appearing in search field on Chrome and IE */ input[type=search]::-ms-clear { display: none; width: 0; height: 0; } input[type=search]::-ms-reveal { display: none; width: 0; height: 0; } input[type=search]::-webkit-search-decoration, input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-results-button, input[type=search]::-webkit-search-results-decoration { display: none; }