- iOS:
ChatCellView.answerView, introView, warningView, sourceView, ChatDisclosurein govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Views/Chat/ChatCellView.swift at fc2b3b1d - iOS:
Theme.govUKin govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Views/Chat/ChatMarkdownTheme.swift at fc2b3b1d - iOS:
fills.surfaceChatAnswer, strokes.chatDividerin govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Extensions/GovKit/GOVUKColors+Chat.swift at fc2b3b1d - iOS:
introMessage, introMessageRetention, mistakesTitle, sourceListTitlein govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Resources/Strings/Chat.xcstrings at fc2b3b1d - Android:
Answerin govuk-once/govuk-mobile-android-app/feature/chat/src/main/kotlin/uk/gov/govuk/chat/ui/component/Answer.kt at 9952400f - Android:
Sourcesin govuk-once/govuk-mobile-android-app/feature/chat/src/main/kotlin/uk/gov/govuk/chat/ui/component/Sources.kt at 9952400f - Android:
Messagein govuk-once/govuk-mobile-android-app/feature/chat/src/main/kotlin/uk/gov/govuk/chat/ui/component/IntroMessages.kt at 9952400f - Figma: none linked yet
Chat answer
Shows GOV.UK Chat's answer to a question, on a white card the width of the conversation, with the GOV.UK pages it used and a warning to check them. Also GOV.UK Chat's welcome message, at the start of a new chat.
GOV.UK app component
Examples
With the pages it used
HTML
<govuk-app-chat-answer sources-open>
<govuk-app-text>You can renew your passport online. It costs £94.50 and usually takes up to 3 weeks.</govuk-app-text>
<govuk-app-text>You’ll need a <govuk-app-link href="https://www.gov.uk/photos-for-passports">digital photo</govuk-app-link> and a credit or debit card.</govuk-app-text>
<govuk-app-chat-source href="https://www.gov.uk/renew-adult-passport">Renew or replace your adult passport</govuk-app-chat-source>
<govuk-app-chat-source href="https://www.gov.uk/passport-fees">Passport fees</govuk-app-chat-source>
</govuk-app-chat-answer>
Its pages closed, as the app starts it
HTML
<govuk-app-chat-answer>
<govuk-app-text>You can renew your passport online. It costs £94.50 and usually takes up to 3 weeks.</govuk-app-text>
<govuk-app-chat-source href="https://www.gov.uk/renew-adult-passport">Renew or replace your adult passport</govuk-app-chat-source>
<govuk-app-chat-source href="https://www.gov.uk/passport-fees">Passport fees</govuk-app-chat-source>
</govuk-app-chat-answer>
With headings and lists
HTML
<govuk-app-chat-answer>
<govuk-app-text>There are different ways to get a passport, depending on whether it’s your first adult passport or you’re renewing one.</govuk-app-text>
<govuk-app-heading level="3" size="body">First adult passport</govuk-app-heading>
<govuk-app-text>You can apply online or with a paper form. Applying online:</govuk-app-text>
<govuk-app-bulleted-list spacing="compact">
<govuk-app-bulleted-list-item>costs £94.50</govuk-app-bulleted-list-item>
<govuk-app-bulleted-list-item>needs a <govuk-app-link href="https://www.gov.uk/photos-for-passports">digital photo</govuk-app-link> and someone to confirm your identity</govuk-app-bulleted-list-item>
</govuk-app-bulleted-list>
<govuk-app-heading level="3" size="body">Renewing a passport</govuk-app-heading>
<govuk-app-text>You can <govuk-app-link href="https://www.gov.uk/renew-adult-passport">renew your passport online</govuk-app-link>.</govuk-app-text>
<govuk-app-chat-source href="https://www.gov.uk/apply-first-adult-passport">Apply for your first adult passport</govuk-app-chat-source>
<govuk-app-chat-source href="https://www.gov.uk/renew-adult-passport">Renew or replace your adult passport</govuk-app-chat-source>
</govuk-app-chat-answer>
Without sources
HTML
<govuk-app-chat-answer>
<govuk-app-text>Sorry, I cannot answer that. Try asking about something on GOV.UK.</govuk-app-text>
</govuk-app-chat-answer>
The welcome message
HTML
<govuk-app-chat-answer note="Messages will be saved for 90 days.">
<govuk-app-text>Hi, I’m GOV.UK Chat 👋. I use AI to help you find what you need on GOV.UK.</govuk-app-text>
</govuk-app-chat-answer>
Inputs
| Attribute | Type | Default | Description |
|---|---|---|---|
note |
string |
A note below the message, in small grey text, 24pt below it, as the welcome message says Messages will be saved for 90 days. | |
sources-open |
boolean |
false |
Draws the list of GOV.UK pages open. The app starts it closed, and the user opens it. |
Content
The answer, written with <govuk-app-text>, <govuk-app-heading level="3" size="body"> and <govuk-app-bulleted-list spacing="compact">, with <govuk-app-link> for links in them. Then a <govuk-app-chat-source href="…"> for each GOV.UK page it used, holding the page's title. With sources, it draws the warning and the list of pages.
Outputs
toggle: From the list of GOV.UK pages, a <details>, when the user opens or closes it.click: From a link in the answer, or a GOV.UK page in its list, when it's pressed.
Rules
- Follow each question with its answer.
- Give an answer the GOV.UK pages it used, as the app's answers have, so the warning to check them is shown. Leave them off only to show an answer the app couldn't find pages for.
- Write the answer as GOV.UK Chat would: short paragraphs, headings in Body, semibold, and lists, with links to GOV.UK pages.
- Start a new chat with the welcome message: Hi, I’m GOV.UK Chat 👋. I use AI to help you find what you need on GOV.UK., with the note Messages will be saved for 90 days. Leave its sources off.
When not to use it
| When | Use instead |
|---|---|
| For the user's own question | govuk-app-chat-question |
| While the answer is being generated | govuk-app-chat-loading stage="generating" |
| For text on a screen that isn't GOV.UK Chat | govuk-app-text |
The iOS, Android and Figma sources it was built from
Screenshots of the app's own component, to compare the examples with
iOS