HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebrick-2.10Haskell2010

Brick.Widgets.Dialog

This module provides a simple dialog widget. You get to pick the dialog title, if any, as well as its body and buttons.

Note that this dialog is really for simple use cases where you want to get the user's answer to a question, such as "Would you like to save changes before quitting?" As is typical in such cases, we assume that this dialog box is used modally, meaning that while it is open it is has exclusive input focus until it is closed.

If you require something more sophisticated, you'll need to build it yourself. You might also consider seeing the Brick.Forms module for help with input management and see the implementation of this module to see how to reproduce a dialog-style UI.

  • 1 type
  • 15 values
  • Packagebrick-2.10
  • Exports16
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDialog.hs
datadata Dialog a n
#

Dialogs present a window with a title (optional), a body, and buttons (optional). Dialog buttons are labeled with strings and map to values of type a, which you choose.

Dialogs handle the following events by default with handleDialogEvent:

  • Tab or Right Arrow: select the next button

  • Shift-tab or Left Arrow: select the previous button

Construction and rendering

4 declarations
valuedialog
  1. :: Eq n
  2. => Maybe (Widget n)

    The dialog title

  3. -> Maybe (n, [(String, n, a)])

    The currently-selected button resource name and the button labels, resource names, and values to use for each button, respectively

  4. -> Int

    The maximum width of the dialog

  5. -> Dialog a n
#

Create a dialog.

valuerenderDialog :: Ord n => Dialog a n -> Widget n -> Widget n
#

Render a dialog with the specified body widget. This renders the dialog as a layer, which makes this suitable as a top-level layer in your rendering function to be rendered on top of the rest of your interface.

Handling events

1 declaration

Getting a dialog's current value

1 declaration
valuedialogSelection :: Eq n => Dialog a n -> Maybe (n, a)
#

Obtain the resource name and value associated with the dialog's currently-selected button, if any. The result of this function is probably what you want when someone presses Enter in a dialog.

Attributes

3 declarations

Lenses

3 declarations