MetadataPanel
Description
MetadataPanel is the narrow column of facts shown beside an issue conversation: a stack of MetadataSections divided by hairlines. Each section has a small title, an optional gear button added by .OnEdit(...), and either its content or a muted empty text such as "No one assigned" ("None yet" by default). Sections have helpers for people, tinted labels, icon items with a subtitle, and avatar rows with a +N overflow; .Content(...) takes any component. The panel is usually about 256px wide.
Usage
Create the panel with MetadataPanel() and pass its sections to .Children(...). OnEdit hands the gear button to the callback, so a ContextMenu can be anchored to it.
Sections with no content show their empty text. .Compact() reduces the spacing and avatar size:
API reference
public sealed class MetadataPanel : IComponent, IHasMarginPaddingThe column of facts that sits beside a Conversation in an issue tracker - assignees, labels, milestone, participants - as a stack of MetadataSections divided by hairlines. Each section has a small title, an optional edit (gear) button, and either its content or a muted "None yet" line.
- Namespace
- Tesserae
- Implements
- IComponent, IHasMarginPadding
Constructors
| Name | Description |
|---|---|
| MetadataPanel | Initializes a new, empty panel. |
Properties
| Name | Description |
|---|---|
| Margin | |
| Padding | |
| Sections | The sections in the panel, top to bottom. |
| IsCompact | Whether the panel is drawn in its dense form (see Compact). |
public IReadOnlyList<MetadataSection> SectionsThe sections in the panel, top to bottom.
Methods
| Name | Description |
|---|---|
| Add | Appends a section. |
| Children | Appends several sections. |
| Remove | Removes a section. |
| Compact | Draws the panel densely: less space between and inside sections, a shorter header row and smaller avatars. |
| AriaLabel | Sets the accessible name of the panel ("Details" by default). |
| Render | Renders the component. |
public MetadataPanel Children(params MetadataSection[] sections)Appends several sections.
public MetadataPanel Compact(bool value = true)Draws the panel densely: less space between and inside sections, a shorter header row and smaller avatars.
public MetadataPanel AriaLabel(string label)Sets the accessible name of the panel ("Details" by default).
public sealed class MetadataSection : ComponentBase<MetadataSection, HTMLElement>One section of a MetadataPanel: a small title, an optional edit button, and its content - people, label tags, a list of linked items, a row of avatars, or any component. While it has no content it shows its empty text instead.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<MetadataSection, HTMLElement> → MetadataSection
Constructors
| Name | Description |
|---|---|
| MetadataSection | Initializes a new section. |
Properties
Methods
| Name | Description |
|---|---|
| Empty | Sets the text shown while the section has no content. |
| Content | Appends components to the section's content. |
| SetContent | Replaces the section's content with these components (none leaves it empty). |
| Text | Appends a line of plain text. |
| Person | Appends a person - their Avatar and name on one line, like an assignee or a reviewer. |
| Labels | Appends a wrapping row of tags - typically Tags tinted with Tint(color), the way an issue's labels look. |
| Item | Appends a linked item: an icon, a title and an optional muted line under it - a milestone and its progress, a linked pull request and its repository, a project and its column. |
| Avatars | Appends a row of avatars, like an issue's participants. At most max are drawn; the rest are counted in a trailing "+N", where N is total (when given) less the avatars drawn. |
| Clear | Removes the section's content, so it shows its empty text. |
| OnEdit | Shows a gear button in the section's header and calls onEdit when it (or the title) is clicked. The argument is the button, to anchor a ContextMenu or a Popover to: .OnEdit(anchor => menu.ShowFor(anchor)). |
| Render | Renders the component. |
public MetadataSection Empty(string emptyText)Sets the text shown while the section has no content.
public MetadataSection Content(params IComponent[] components)Appends components to the section's content.
public MetadataSection SetContent(params IComponent[] components)Replaces the section's content with these components (none leaves it empty).
public MetadataSection Person(string name, Avatar avatar = null, string secondary = null)Appends a person - their Avatar and name on one line, like an assignee or a reviewer.
Parameters
- name
- The name shown.
- avatar
- Their avatar; defaults to one made from the name's initials.
- secondary
- Muted text after the name, e.g. a login or a review state.
public MetadataSection Labels(params IComponent[] labels)Appends a wrapping row of tags - typically Tags tinted with Tint(color), the way an issue's labels look.
public MetadataSection Item(UIcons icon, string title, string subtitle = null, string iconColor = null, Action onClick = null)Appends a linked item: an icon, a title and an optional muted line under it - a milestone and its progress, a linked pull request and its repository, a project and its column.
Parameters
- icon
- The icon before the title.
- title
- The item's title.
- subtitle
- The muted line under the title.
- iconColor
- A CSS colour for the icon (e.g.
Theme.Success.Backgroundfor an open pull request). - onClick
- Called when the title is clicked; makes the title a link-styled button.
public MetadataSection Avatars(IEnumerable<Avatar> avatars, int max = 10, int? total = null)Appends a row of avatars, like an issue's participants. At most max are drawn; the rest are counted in a trailing "+N", where N is total (when given) less the avatars drawn.
public MetadataSection Clear()Removes the section's content, so it shows its empty text.
public MetadataSection OnEdit(Action<IComponent> onEdit)Shows a gear button in the section's header and calls onEdit when it (or the title) is clicked. The argument is the button, to anchor a ContextMenu or a Popover to: .OnEdit(anchor => menu.ShowFor(anchor)).