def create_inquirer_layout(
    ic: InquirerControl,
    get_prompt_tokens: Callable[[], List[Tuple[str, str]]],
    **kwargs: Any,
) -> Layout:
    """Create a layout combining question and inquirer selection."""

    ps: PromptSession = PromptSession(
        get_prompt_tokens, reserve_space_for_menu=0, **kwargs
    )
    _fix_unecessary_blank_lines(ps)

    @Condition
    def has_search_string():
        return ic.get_search_string_tokens() is not None

    validation_prompt: PromptSession = PromptSession(
        bottom_toolbar=lambda: ic.error_message, **kwargs
    )

    return Layout(
        HSplit(
            [
                ps.layout.container,
                ConditionalContainer(Window(ic), filter=~IsDone()),
                ConditionalContainer(
                    Window(
                        height=LayoutDimension.exact(2),
                        content=FormattedTextControl(ic.get_search_string_tokens),
                    ),
                    filter=has_search_string & ~IsDone(),
                ),
                ConditionalContainer(
                    validation_prompt.layout.container,
                    filter=Condition(lambda: ic.error_message is not None),
                ),
            ]
        )
    )
Create a layout combining question and inquirer selection.
questionary/prompts/common.py