Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra letter spacing modifier for inputs #2230

Merged
merged 3 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ The [Button](https://design-system.service.gov.uk/components/button/) Nunjucks m

This was added in [pull request #3344: Adding optional id attribute to button component](https://github.com/alphagov/govuk-frontend/pull/3344). Thanks to [Tom Billington](https://github.com/TomBillingtonUK) for this contribution.

### Added a modifier for text input styles that accept sequences of digits

We've added a new `.govuk-input--extra-letter-spacing` class for [Text Input](https://design-system.service.gov.uk/components/text-input/). This increases readability of text inputs that receive sequences of digits (like security codes, references or phone numbers).

You can add it through the `classes` option when using Nunjucks, or directly in the `class` attribute of the `<input>` when using HTML.

This was added in [pull request #2230: Add extra letter spacing modifier for inputs](https://github.com/alphagov/govuk-frontend/pull/2230)

### Deprecated features

#### Stop using the `govuk-button--disabled` class on buttons
Expand Down
5 changes: 5 additions & 0 deletions src/govuk/components/input/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
}
}

.govuk-input--extra-letter-spacing {
@include govuk-font(false, $tabular: true);
letter-spacing: .05em;
}

// em measurements are based on the point size of the typeface
// Extra space is added on the right hand side to allow for the Safari prefill icon

Expand Down
7 changes: 7 additions & 0 deletions src/govuk/components/input/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ examples:
text: £
suffix:
text: per item
- name: with extra letter spacing
data:
id: input-with-extra-letter-spacing
label:
text: National insurance number
classes: govuk-input--width-30 govuk-input--extra-letter-spacing
value: QQ 12 34 56 C

# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
- name: classes
Expand Down