diff --git a/.changeset/input-icon-sizes.md b/.changeset/input-icon-sizes.md new file mode 100644 index 000000000..2cf9fa368 --- /dev/null +++ b/.changeset/input-icon-sizes.md @@ -0,0 +1,6 @@ +--- +"@tabler/core": patch +"@tabler/docs": patch +--- + +Fixed `.input-icon` icons off-center in small and large inputs and selects: the addon follows the control size. diff --git a/core/scss/ui/forms/_form-icon.scss b/core/scss/ui/forms/_form-icon.scss index 2e3b758b4..73c9acd78 100644 --- a/core/scss/ui/forms/_form-icon.scss +++ b/core/scss/ui/forms/_form-icon.scss @@ -4,6 +4,7 @@ .input-icon { --input-icon-padding-end: #{$input-icon-padding-end}; --input-icon-padding-start: #{$input-icon-padding-start}; + --input-icon-addon-height: #{input-height-token()}; position: relative; .form-control:not(:last-child), @@ -15,6 +16,14 @@ .form-select:not(:first-child) { padding-inline-start: var(--input-icon-padding-start); } + + &:has(> .form-control-sm, > .form-select-sm) { + --input-icon-addon-height: #{input-height-token('sm')}; + } + + &:has(> .form-control-lg, > .form-select-lg) { + --input-icon-addon-height: #{input-height-token('lg')}; + } } .input-icon-addon { @@ -28,7 +37,7 @@ align-items: center; justify-content: center; min-width: var(--input-icon-addon-width); - height: input-height-token(); + height: var(--input-icon-addon-height, #{input-height-token()}); font-size: 1.2em; color: var(--icon-color); pointer-events: none; diff --git a/docs/content/ui/forms/elements.mdx b/docs/content/ui/forms/elements.mdx index e2da81bf2..00efdec46 100644 --- a/docs/content/ui/forms/elements.mdx +++ b/docs/content/ui/forms/elements.mdx @@ -104,6 +104,29 @@ Put an [icon](/ui/components/icon) inside an input to hint at what goes in it, o +The icon follows the size of the input, set with `.form-control-sm` or `.form-control-lg`. + + +
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ ## Separated inputs Include an additional element in your input section, such as a [button](/ui/components/button) which can be used to submit the information entered in the input control.