Skip to content

Commit

Permalink
Update form-control-color sizing and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed May 20, 2022
1 parent e2e107f commit 652f81e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scss/forms/_form-control.scss
Expand Up @@ -170,20 +170,22 @@ textarea {

.form-control-color {
width: $form-color-width;
height: auto; // Override fixed browser height
height: $input-height;
padding: $input-padding-y;

&:not(:disabled):not([readonly]) {
cursor: pointer;
}

&::-moz-color-swatch {
height: if(unit($input-line-height) == "", $input-line-height * 1em, $input-line-height);
border: 0 !important; // stylelint-disable-line declaration-no-important
@include border-radius($input-border-radius);
}

&::-webkit-color-swatch {
height: if(unit($input-line-height) == "", $input-line-height * 1em, $input-line-height);
@include border-radius($input-border-radius);
}

&.form-control-sm { height: $input-height-sm; }
&.form-control-lg { height: $input-height-lg; }
}
2 changes: 2 additions & 0 deletions site/content/docs/5.2/forms/form-control.md
Expand Up @@ -108,6 +108,8 @@ If you want to have `<input readonly>` elements in your form styled as plain tex

## Color

Set the `type="color"` and add `.form-control-color` to the `<input>`. We use the modifier class to set fixed `height`s and override some inconsistencies between browsers.

{{< example >}}
<label for="exampleColorInput" class="form-label">Color picker</label>
<input type="color" class="form-control form-control-color" id="exampleColorInput" value="#563d7c" title="Choose your color">
Expand Down

0 comments on commit 652f81e

Please sign in to comment.