[New Component] Popover

未关闭
#1,333 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp, javascript

调研方向

Start with the existing Tooltip component and its JavaScript interop in wwwroot/blazor.bootstrap.js, since the issue says Popover should follow the same pattern. Create the new component under blazorbootstrap/Components/Popover/ and add its interop beside Tooltip's. Done means the must-have checklist works in the Server and WebAssembly demo hosts, with XML docs, a demo page and a docs page.

由索引模型根据 Issue 内容生成。

描述

area-popover area-tooltip new component

Summary

Add a Popover component wrapping the Bootstrap 5 popover, with support for rich RenderFragment content and programmatic control.

Motivation

Users regularly ask for richer content than Tooltip supports — tables, formatted text, buttons, and small forms (#725, #1048). Popover is part of Bootstrap 5 and already available in the bundled script, so it follows the existing Tooltip interop pattern.

Proposed API (draft)

<Popover Title="Order details" Placement="PopoverPlacement.Right" Trigger="PopoverTrigger.Click">
    <ContentTemplate>
        <table class="table table-sm mb-0">...</table>
    </ContentTemplate>
    <ChildContent>
        <Button Color="ButtonColor.Primary">Show details</Button>
    </ChildContent>
</Popover>

@code {
    private Popover popover = default!;
    private Task ShowAsync() => popover.ShowAsync();
}

Must-have features (v1)

  • Title / Content (string) and TitleTemplate / ContentTemplate (RenderFragment).
  • Placement (PopoverPlacement: Auto, Top, Right, Bottom, Left).
  • Trigger (PopoverTrigger: Click, Hover, Focus, Manual; combinable).
  • Offset, Container, Color, Disabled.
  • Methods: ShowAsync, HideAsync, ToggleAsync, UpdateAsync (reposition).
  • Events: OnShowing, OnShown, OnHiding, OnHidden.
  • Dismiss on outside click and Escape (configurable AutoClose).
  • Content re-renders in place without destroying and re-creating the popover.
  • Interop instance disposed on component dispose and safe on circuit disconnect.

Accessibility

  • Trigger element gets aria-describedby / aria-expanded.
  • Focus moves into interactive popover content when opened by keyboard and returns to the trigger on close.

Out of scope (later)

  • Using Popover inside Grid filter menus and Dropdowns.
  • Auto width-to-content sizing options.

Acceptance criteria

  • Component in blazorbootstrap/Components/Popover/ with interop in wwwroot/blazor.bootstrap.js.
  • XML docs on all public parameters, methods, and events.
  • Demo page covering: placements, triggers, HTML/table content, programmatic control, events, dismiss behavior, colors, disabled.
  • Verified in Server and WebAssembly demo hosts, including navigation away while a popover is open.
  • Docs page docs/docs/05-components/popover.mdx.
  • Builds for .NET 8, 9, 10.

Related

#725, #1048

主要语言
HTML
星标
1.2k
派生
111
平均合并
4 分钟
30 天内合并 PR
55

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vikramlearning/blazorbootstrap 的其他 Issue

查看 vikramlearning/blazorbootstrap 的全部 Issue

相似的 Issue

更多 Accessibility Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。