-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add guide page for the password field
- Loading branch information
1 parent
1ddf5e2
commit d316ce7
Showing
6 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Password fields | ||
--- | ||
|
||
markdown: | ||
This component allows users to enter a password, with an option to show what they’ve entered as plain text. | ||
|
||
Use this component whenever you need users to create or enter a password. | ||
|
||
== render('/partials/example.*', | ||
caption: 'A default password field', | ||
code: default_password) | ||
|
||
== render('/partials/example.*', | ||
caption: 'A password field with a custom label, caption and hint', | ||
code: password_with_a_captioned_heading_label_and_hint) do | ||
markdown: | ||
The password field's title, caption and hint can be customised in the usual way. | ||
|
||
== render('/partials/example.*', | ||
caption: 'Password field with custom text', | ||
code: password_with_custom_text) do | ||
markdown: | ||
The component's text can be customised or localised by providing the following arguments: | ||
|
||
ul.govuk-list.govuk-list--bullet | ||
li <code>show_password_text</code> and <code>hide_password_text</code> set the text on the button | ||
li <code>show_password_aria_label_text</code> and <code>hide_password_aria_label_text</code> control the text exposed to assistive technologies like screen readers | ||
li <code>password_shown_announcement_text</code> and <code>password_hidden_announcement_text</code> control announcements made to screen reader users when the button is clicked | ||
|
||
== render('/partials/related-navigation.*', links: password_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Examples | ||
module Password | ||
def default_password | ||
<<~PASSWORD | ||
= f.govuk_password_field :password, label: { text: "Enter your password" } | ||
PASSWORD | ||
end | ||
|
||
def password_with_a_captioned_heading_label_and_hint | ||
<<~PASSWORD | ||
= f.govuk_password_field(:pin, | ||
label: { text: "Enter your PIN", tag: "h2", size: "l" }, | ||
caption: { text: "Security", size: "m" }, | ||
hint: { text: "Your PIN was emailed to you when you registered for this service" }) | ||
PASSWORD | ||
end | ||
|
||
def password_with_custom_text | ||
<<~PASSWORD | ||
= f.govuk_password_field(:secret_code, | ||
label: { text: "Enter your secret code" }, | ||
show_password_text: "Display", | ||
hide_password_text: "Conceal", | ||
show_password_aria_label_text: "Display the secret code", | ||
hide_password_aria_label_text: "Conceal the secret code", | ||
password_shown_announcement_text: "The secret code has been displayed", | ||
password_hidden_announcement_text: "The secret code has been concealed") | ||
PASSWORD | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters