Skip to main content

These components are for prototyping the GOV.UK app, not for use in production.

<govuk-app-chat-answer>

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

You can renew your passport online. It costs £94.50 and usually takes up to 3 weeks. You’ll need a digital photo and a credit or debit card. Renew or replace your adult passport Passport fees You can renew your passport online. It costs £94.50 and usually takes up to 3 weeks. You’ll need a digital photo and a credit or debit card. Renew or replace your adult passport Passport fees

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

You can renew your passport online. It costs £94.50 and usually takes up to 3 weeks. Renew or replace your adult passport Passport fees You can renew your passport online. It costs £94.50 and usually takes up to 3 weeks. Renew or replace your adult passport Passport fees

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

There are different ways to get a passport, depending on whether it’s your first adult passport or you’re renewing one. First adult passport You can apply online or with a paper form. Applying online: costs £94.50 needs a digital photo and someone to confirm your identity Renewing a passport You can renew your passport online. Apply for your first adult passport Renew or replace your adult passport There are different ways to get a passport, depending on whether it’s your first adult passport or you’re renewing one. First adult passport You can apply online or with a paper form. Applying online: costs £94.50 needs a digital photo and someone to confirm your identity Renewing a passport You can renew your passport online. Apply for your first adult passport Renew or replace your adult passport

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

Sorry, I cannot answer that. Try asking about something on GOV.UK. Sorry, I cannot answer that. Try asking about something on GOV.UK.

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

Hi, I’m GOV.UK Chat 👋. I use AI to help you find what you need on GOV.UK. Hi, I’m GOV.UK Chat 👋. I use AI to help you find what you need on GOV.UK.

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

Attributes
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

Sources

The iOS, Android and Figma sources it was built from
  • iOS: ChatCellView.answerView, introView, warningView, sourceView, ChatDisclosure in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Views/Chat/ChatCellView.swift at fc2b3b1d
  • iOS: Theme.govUK in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Views/Chat/ChatMarkdownTheme.swift at fc2b3b1d
  • iOS: fills.surfaceChatAnswer, strokes.chatDivider in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Extensions/GovKit/GOVUKColors+Chat.swift at fc2b3b1d
  • iOS: introMessage, introMessageRetention, mistakesTitle, sourceListTitle in govuk-once/govuk-mobile-ios-app/Production/govuk_ios/Resources/Strings/Chat.xcstrings at fc2b3b1d
  • Android: Answer in govuk-once/govuk-mobile-android-app/feature/chat/src/main/kotlin/uk/gov/govuk/chat/ui/component/Answer.kt at 9952400f
  • Android: Sources in govuk-once/govuk-mobile-android-app/feature/chat/src/main/kotlin/uk/gov/govuk/chat/ui/component/Sources.kt at 9952400f
  • Android: Message in 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

In the app

Screenshots of the app's own component, to compare the examples with

iOS

iOS app: The welcome message, then an answer with its list of pages open, in light mode
The welcome message, then an answer with its list of pages open, in light mode
iOS app: The same, in dark mode
The same, in dark mode
iOS app: An answer's headings and lists, in light mode
An answer's headings and lists, in light mode
iOS app: The same, in dark mode
The same, in dark mode
iOS app: An answer without sources, in light mode
An answer without sources, in light mode
iOS app: The welcome message alone, in a new chat, in light mode
The welcome message alone, in a new chat, in light mode
iOS app: The same, in dark mode
The same, in dark mode