BBC's guide to development
  • General

    • About
    • Tools
    • Git(hub)
    • Showpad
    • Hosting
    • Maintenance
    • Security
    • Go live checklist
  • Front-end development

    • Bundlers
    • CSS/SCSS
    • Javascript
    • Vue
    • PHP
    • Mails
    • Dev Faq
  • Functions
  • Mixins
  • General

    • OOP Structure
  • Component Classes

    • Accordion
    • App
    • Component
    • HighwayApp
    • Popup
    • PNG Sequencer
    • Tab
  • Manager Classes

    • BountListenerMgr
    • Cache
    • Configuration
    • InViewStateMgr
    • Instance Manager
    • Event dispatcher
  • Factories

    • SwiperFactory
  • PDF

    • AssetLoader
    • BasePdfDoc
    • TemplatePdfDoc
    • CustomPdfDoc
  • Utility functions

    • canvas
    • Connection Status
    • css
    • dev
    • placeholder
    • dom
    • fetch
    • json
    • object
    • scroll
    • scrollbar
    • spreadsheets
    • string
    • url
  • General

    • ComponentMgr
    • ThreeJsViewer
  • Components

    • ComponentMgr
    • GltfModel
    • Snappable
    • Socket
    • ThreeJsViewer
    • ThreeJsViewerCamera
  • Loaders

    • ConfigurationSerializer
    • GltfBlockParser
  • Utils

    • CanvasInputAdapter
    • CollisionManager
    • SocketGridExpander
    • blender
    • headless
  • General

    • Troubleshooting
    • Legacy
  • Components

    • AssetBar
    • ConfigGenerator
    • ShowpadApp
  • Managers

    • Assets
    • AppsDb
    • Config
  • Utils

    • Connection Status
    • general
    • showpad-interactive
    • showpad-upload
  • Components

    • Accordion
    • BackButton
    • Breadcrumb
    • ByltButton
    • Hamburger
    • Icon
    • Logo
    • Loader
    • Modal
    • Popup
    • Prompt
    • ProgressBar
    • TextLoader
  • Composables

    • useDebugMode
    • useConnectionStatus
  • Utils

    • dom
    • props
  • General

    • General
    • Tracking
  • Components

    • Accordion
    • ActionButton
    • AssetItem
    • AssetList
    • BackButton
    • ConfigGenButton
    • Logo
    • Media
    • Modal
    • Popup
    • Prompt
    • SPButton
    • SPRouterView
    • SPTrackedRouterLink
    • TextLoader
    • View
  • Composables

    • useConnectionStatus
  • Stores

    • useAppsDbStore
    • useBreadcrumbStore
    • useShowpadAPIStore
    • useShowpadSDKStore
    • useSpConfigStore
    • useSpStore
    • useSpTrackingStore
  • The New Kit

    • General
    • Installation & Usage
    • ACF Blocks
    • PHPCS
    • Functions
    • Vite
    • WP Config
    • Staging Deployment
  • Best Practices

    • Page Structure
    • Fonts/Typography
  • Todo
GitHub
  • General

    • About
    • Tools
    • Git(hub)
    • Showpad
    • Hosting
    • Maintenance
    • Security
    • Go live checklist
  • Front-end development

    • Bundlers
    • CSS/SCSS
    • Javascript
    • Vue
    • PHP
    • Mails
    • Dev Faq
  • Functions
  • Mixins
  • General

    • OOP Structure
  • Component Classes

    • Accordion
    • App
    • Component
    • HighwayApp
    • Popup
    • PNG Sequencer
    • Tab
  • Manager Classes

    • BountListenerMgr
    • Cache
    • Configuration
    • InViewStateMgr
    • Instance Manager
    • Event dispatcher
  • Factories

    • SwiperFactory
  • PDF

    • AssetLoader
    • BasePdfDoc
    • TemplatePdfDoc
    • CustomPdfDoc
  • Utility functions

    • canvas
    • Connection Status
    • css
    • dev
    • placeholder
    • dom
    • fetch
    • json
    • object
    • scroll
    • scrollbar
    • spreadsheets
    • string
    • url
  • General

    • ComponentMgr
    • ThreeJsViewer
  • Components

    • ComponentMgr
    • GltfModel
    • Snappable
    • Socket
    • ThreeJsViewer
    • ThreeJsViewerCamera
  • Loaders

    • ConfigurationSerializer
    • GltfBlockParser
  • Utils

    • CanvasInputAdapter
    • CollisionManager
    • SocketGridExpander
    • blender
    • headless
  • General

    • Troubleshooting
    • Legacy
  • Components

    • AssetBar
    • ConfigGenerator
    • ShowpadApp
  • Managers

    • Assets
    • AppsDb
    • Config
  • Utils

    • Connection Status
    • general
    • showpad-interactive
    • showpad-upload
  • Components

    • Accordion
    • BackButton
    • Breadcrumb
    • ByltButton
    • Hamburger
    • Icon
    • Logo
    • Loader
    • Modal
    • Popup
    • Prompt
    • ProgressBar
    • TextLoader
  • Composables

    • useDebugMode
    • useConnectionStatus
  • Utils

    • dom
    • props
  • General

    • General
    • Tracking
  • Components

    • Accordion
    • ActionButton
    • AssetItem
    • AssetList
    • BackButton
    • ConfigGenButton
    • Logo
    • Media
    • Modal
    • Popup
    • Prompt
    • SPButton
    • SPRouterView
    • SPTrackedRouterLink
    • TextLoader
    • View
  • Composables

    • useConnectionStatus
  • Stores

    • useAppsDbStore
    • useBreadcrumbStore
    • useShowpadAPIStore
    • useShowpadSDKStore
    • useSpConfigStore
    • useSpStore
    • useSpTrackingStore
  • The New Kit

    • General
    • Installation & Usage
    • ACF Blocks
    • PHPCS
    • Functions
    • Vite
    • WP Config
    • Staging Deployment
  • Best Practices

    • Page Structure
    • Fonts/Typography
  • Todo
GitHub
  • Prompt

Prompt

import { Prompt } from '@bbc/front-end-kit/vue'

A flexible prompt dialog component built on top of the Popup component. It is designed for collecting user input or confirmation, supporting custom forms, configurable action buttons, and advanced customization via slots and component overrides.

Getting started

<template>
    <Prompt
        v-model:visible="showPrompt"
        v-model:values="formValues"
        :options="[
            { label: 'Yes', value: true, type: 'submit' },
            { label: 'No', value: false, props: { class: '--bordered' } }
        ]"
        @answered="onAnswered"
    >
        <template #form>
            <FormKit type="textarea" name="reason" placeholder="Reason (optional)" />
        </template>
    </Prompt>
</template>

<script setup>
import { ref } from 'vue';
import { Prompt } from '@bbc/front-end-kit/vue';

const showPrompt = ref(false);
const formValues = ref({});

function onAnswered({ values, answer }) {
  console.log('User answered:', answer, 'Form values:', values);
}
</script>

Guidelines

  • Use the options prop to define the set of actions the user can take (e.g., Accept/Decline).
  • Use the form slot for custom form fields inside the prompt.
  • Options with type: 'submit' trigger FormKit's form submission and pass the collected field values in the answered payload. Options without it close the prompt immediately with values: null.
  • The prompt always sets :can-close="false" on the underlying Popup — the close button is never shown. The only way to close it is by clicking one of the action buttons.
  • You can override the Popup and Button components for advanced customization.

API

Properties

options

Array of button option objects to display as actions. Each option should have at least a label and value. You can also pass extra props to each button via the props key. Options with type: 'submit' trigger form submission; all others close the prompt immediately.

Values: Array of objects { label: String, value: any, type?: String, props?: Object }

Default:

[
  { label: 'Accept', value: true, type: 'submit' },
  { label: 'Decline', value: false, props: { class: '--bordered' } }
]

Popup

Override the Popup component used for the prompt container.

Values: Vue Component

Default: Popup

Button

Override the Button component used for the action buttons.

Values: Vue Component

Default: ByltButton

Models

visible

Reactive flag to toggle the prompt's visibility.

Type: Boolean

Default: false

values

Initial values for the form. Note: this is passed via :model to the inner FormKit form, which is non-standard — FormKit manages its own internal field state. The answered payload's values comes from FormKit's own submit event, not from this model.

Type: Object

Default: {}

Events

answered

Emitted when an action button is clicked. The prompt closes automatically after emitting.

For submit-type options: values contains the FormKit form data, answer is the option's value.

For non-submit options: values is null, answer is the option's value.

Payload: { values: Object|null, answer: any }

Slots

default

Rendered inside the popup__header wrapper. Use this to provide a custom header for the prompt.

form

Custom form fields rendered inside the FormKit form element. Use <FormKit> components here — their values are collected automatically on submit.

Edit this page
Last Updated: 4/27/26, 12:56 PM
Contributors: Nicolas Jaenen