Sidebar
Description
A sidebar navigation component
A fully featured Sidebar with Search, Navigation, Buttons, and Separators.
API reference
public sealed class Sidebar : IComponentA Sidebar component that can be collapsed or expanded, containing header, middle, and footer sections.
- Namespace
- Tesserae
- Implements
- IComponent
Constructors
| Name | Description |
|---|---|
| Sidebar | Initializes a new instance of the Sidebar class. |
Properties
| Name | Description |
|---|---|
| IsClosed | Gets or sets whether the sidebar is closed. |
Methods
| Name | Description |
|---|---|
| Secondary | Sets the sidebar background to the secondary background color. |
| Sortable | Sets whether the middle content items are sortable. |
| AsNavbar | Configures the sidebar to render as a navbar. |
| Closed | Sets whether the sidebar is closed. |
| Toggle | Toggles the closed state of the sidebar. |
| AddHeader | Adds an item to the sidebar header section. |
| InsertAfterHeader | Inserts an item after another item in the sidebar header section. |
| AddContent | Adds an item to the middle content section. |
| InsertAfterContent | Inserts an item after another item in the middle content section. |
| RemoveContent | Removes an item from the middle content section. |
| AddFooter | Adds an item to the sidebar footer section. |
| InsertAfterFooter | Inserts an item after another item in the sidebar footer section. |
| Clear | Clears all sections of the sidebar. |
| ClearHeader | Clears the header section. |
| ClearContent | Clears the middle content section. |
| ClearFooter | Clears the footer section. |
| Render | Renders the sidebar. |
| LoadSorting | Loads the sorting order for sidebar items. Should be called after all items have been added. |
| GetCurrentSorting | Gets the current sorting order of all items in the sidebar. |
| Refresh | Refreshes the sidebar rendering. |
| OnSortingChanged | Adds a sorting change event handler. |
| Search | Searches/Filters the sidebar content items. |
| GetOwnIdentifier | Gets the own identifier of an item by removing group identifier prefix. |
public Sidebar Secondary()Sets the sidebar background to the secondary background color.
Returns
The current instance of the type.
public void Sortable(bool sortable = true)Sets whether the middle content items are sortable.
Parameters
- sortable
- Whether items are sortable.
public Sidebar Closed(bool isClosed = true)Sets whether the sidebar is closed.
Parameters
- isClosed
- Whether the sidebar is closed.
Returns
The current instance of the type.
public Sidebar Toggle()Toggles the closed state of the sidebar.
Returns
The current instance of the type.
public Sidebar AddHeader(ISidebarItem item)Adds an item to the sidebar header section.
Parameters
- item
- The item to add.
Returns
The current instance of the type.
public Sidebar InsertAfterHeader(ISidebarItem item, ISidebarItem addAfter)Inserts an item after another item in the sidebar header section.
Parameters
- item
- The item to insert.
- addAfter
- The item to insert after.
Returns
The current instance of the type.
public Sidebar AddContent(ISidebarItem item)Adds an item to the middle content section.
Parameters
- item
- The item to add.
Returns
The current instance of the type.
public Sidebar InsertAfterContent(ISidebarItem item, ISidebarItem addAfter)Inserts an item after another item in the middle content section.
Parameters
- item
- The item to insert.
- addAfter
- The item to insert after.
Returns
The current instance of the type.
public Sidebar RemoveContent(ISidebarItem item)Removes an item from the middle content section.
Parameters
- item
- The item to remove.
Returns
The current instance of the type.
public void LoadSorting(Dictionary<string, string[]> itemOrder)Loads the sorting order for sidebar items. Should be called after all items have been added.
Parameters
- itemOrder
- A dictionary mapping group identifiers to ordered item identifiers.
public Dictionary<string, string[]> GetCurrentSorting()Gets the current sorting order of all items in the sidebar.
Returns
A dictionary mapping group identifiers to ordered item identifiers.
public void OnSortingChanged(Action<Dictionary<string, string[]>> onSortingChanged)Adds a sorting change event handler.
Parameters
- onSortingChanged
- The event handler.
public void Search(string searchTerm)Searches/Filters the sidebar content items.
Parameters
- searchTerm
- The term to search for.
Fields
| Name | Description |
|---|---|
| SIDEBAR_TRANSITION_TIME | The transition time for sidebar animations in milliseconds. |
| ROOT_SIDEBAR_FOR_ORDERING | The root identifier used for ordering. |
| GroupIdentifierSeparator | The separator used between group identifiers and item identifiers. |
public const int SIDEBAR_TRANSITION_TIME = 300The transition time for sidebar animations in milliseconds.
public const string ROOT_SIDEBAR_FOR_ORDERING = "ROOT"The root identifier used for ordering.
public class SidebarButton : ISearchableSidebarItemA Button component for use within a Sidebar, supporting both open and closed states.
- Namespace
- Tesserae
- Implements
- ISearchableSidebarItem
Properties
| Name | Description |
|---|---|
| IsSelected | Gets or sets whether the button is currently selected. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the button. |
| OwnIdentifier | Gets the own identifier of the button. |
public bool IsSelected { get ; set ; }Gets or sets whether the button is currently selected.
public IComponent CurrentRenderedGets the component that is currently rendered.
public string Identifier { get; private set; }Gets the full identifier of the button.
Methods
| Name | Description |
|---|---|
| AddGroupIdentifier | Adds a group identifier prefix to the button's identifier. |
| Show | Shows the button. |
| Collapse | Collapses the button. |
| NotSortable | Marks the button as not sortable. |
| ClearProgress | Clears the progress indication background. |
| Progress | Sets a progress indication background. |
| SetText | Sets the text of the button. |
| CommandsAlwaysVisible | Ensures that commands associated with the button are always visible when the sidebar is open. |
| Light | Sets the button to use a light style. |
| Danger | Sets the button to use a danger style. |
| Default | Sets the button to use the default style. |
| Success | Sets the button to use a success style. |
| Primary | Sets the button to use the primary style. |
| Selected | Sets whether the button is selected. |
| Tooltip | Sets a tooltip for the closed state button. |
| OpenedTooltip | Sets a tooltip for the open state button. |
| OnClick | Adds a click event handler to the button. |
| OnOpenIconClick | Adds a click event handler to the icon when the button is open. |
| Id | Sets the ID of the button. |
| OnContextMenu | Adds a context menu event handler to the button. |
| SetIcon | Sets the icon for the button. |
| OnRendered | Adds a rendered event handler. |
| RenderClosed | Renders the button for the closed state of the sidebar. |
| RenderOpen | Renders the button for the open state of the sidebar. |
public void AddGroupIdentifier(string groupIdentifier)Adds a group identifier prefix to the button's identifier.
public SidebarButton NotSortable()Marks the button as not sortable.
Returns
The current instance of the type.
public SidebarButton ClearProgress()Clears the progress indication background.
Returns
The current instance of the type.
public SidebarButton Progress(float progress)Sets a progress indication background.
Parameters
- progress
- The progress value (0 to 1).
Returns
The current instance of the type.
public SidebarButton SetText(string text)Sets the text of the button.
Parameters
- text
- The text.
Returns
The current instance of the type.
public SidebarButton CommandsAlwaysVisible(bool alwaysVisible = true)Ensures that commands associated with the button are always visible when the sidebar is open.
Returns
The current instance of the type.
public SidebarButton Light()Sets the button to use a light style.
Returns
The current instance of the type.
public SidebarButton Danger()Sets the button to use a danger style.
Returns
The current instance of the type.
public SidebarButton Default()Sets the button to use the default style.
Returns
The current instance of the type.
public SidebarButton Success()Sets the button to use a success style.
Returns
The current instance of the type.
public SidebarButton Primary()Sets the button to use the primary style.
Returns
The current instance of the type.
public SidebarButton Selected(bool isSelected = true)Sets whether the button is selected.
Parameters
- isSelected
- Whether the button is selected.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Tooltip(string) | Sets a tooltip for the closed state button. |
| Tooltip(IComponent) | Sets a tooltip component for the closed state button. |
| Tooltip(Func<IComponent>) | Sets a tooltip generator function for the closed state button. |
Tooltip(string)
public SidebarButton Tooltip(string text)Sets a tooltip for the closed state button.
Parameters
- text string
- The tooltip text.
Returns
The current instance of the type.
| Overload | |
|---|---|
| OpenedTooltip(string) | Sets a tooltip for the open state button. |
| OpenedTooltip(IComponent) | Sets a tooltip component for the open state button. |
| OpenedTooltip(Func<IComponent>) | Sets a tooltip generator function for the open state button. |
OpenedTooltip(string)
public SidebarButton OpenedTooltip(string text)Sets a tooltip for the open state button.
Parameters
- text string
- The tooltip text.
Returns
The current instance of the type.
| Overload | |
|---|---|
| OnClick(Action) | Adds a click event handler to the button. |
| OnClick(Action<Button, MouseEvent>) | Adds a click event handler with button and mouse event arguments. |
| Overload | |
|---|---|
| OnOpenIconClick(Action<HTMLElement, MouseEvent>) | Adds a click event handler to the icon when the button is open. |
| OnOpenIconClick(Action) | Adds a click event handler to the icon when the button is open. |
OnOpenIconClick(Action<HTMLElement, MouseEvent>)
public SidebarButton OnOpenIconClick(Action<HTMLElement, MouseEvent> action)Adds a click event handler to the icon when the button is open.
Parameters
- action Action<HTMLElement, MouseEvent>
- The event handler action.
Returns
The current instance of the type.
public SidebarButton Id(string id)Sets the ID of the button.
Parameters
- id
- The ID.
Returns
The current instance of the type.
| Overload | |
|---|---|
| OnContextMenu(Action) | Adds a context menu event handler to the button. |
| OnContextMenu(Action<Button, MouseEvent>) | Adds a context menu event handler with button and mouse event arguments. |
| Overload | |
|---|---|
| SetIcon(UIcons, string, UIconsWeight) | Sets the icon for the button. |
| SetIcon(Emoji) | Sets an emoji icon for the button. |
SetIcon(UIcons, string, UIconsWeight)
public SidebarButton SetIcon(UIcons icon, string color = "", UIconsWeight weight = UIconsWeight.Regular)Sets the icon for the button.
Parameters
- icon UIcons
- The icon.
- color string
- The color of the icon.
- weight UIconsWeight
- The weight of the icon.
Returns
The current instance of the type.
public ISidebarItem OnRendered(Action<HTMLElement> onRendered)Adds a rendered event handler.
Parameters
- onRendered
- The rendered event handler.
Returns
The current instance of the type.
public IComponent RenderClosed()Renders the button for the closed state of the sidebar.
public sealed class SidebarPivot : ISearchableSidebarItem- Namespace
- Tesserae
- Implements
- ISearchableSidebarItem
public class SidebarSearchBox : ISidebarItem- Namespace
- Tesserae
- Implements
- ISidebarItem
public class SidebarCommand : IComponentA Command component for use within a Sidebar, typically appearing as a small action button.
- Namespace
- Tesserae
- Implements
- IComponent
Methods
| Name | Description |
|---|---|
| Foreground | Sets the foreground color of the command button. |
| HookToParentContextMenu | Configures the command to hook into the parent's context menu event. |
| Background | Sets the background color of the command button. |
| Default | Sets the command to use the default style. |
| Primary | Sets the command to use the primary style. |
| Success | Sets the command to use the success style. |
| Danger | Sets the command to use the danger style. |
| Tooltip | Sets a tooltip for the command. |
| OnClickMenu | Configures the command to show a menu when clicked. |
| ShowMenu | Shows the associated menu for the command. |
| RaiseOnClick | Programmatically raises the click event. |
| RaiseOnContextMenu | Programmatically raises the context menu event. |
| OnClick | Adds a click event handler. |
| OnContextMenu | Adds a context menu event handler. |
| SetIcon | Sets the icon for the command. |
| Render | Renders the sidebar command. |
public SidebarCommand Foreground(string color)Sets the foreground color of the command button.
Parameters
- color
- The color.
Returns
The current instance of the type.
public SidebarCommand HookToParentContextMenu()Configures the command to hook into the parent's context menu event.
Returns
The current instance of the type.
public SidebarCommand Background(string color)Sets the background color of the command button.
Parameters
- color
- The color.
Returns
The current instance of the type.
public SidebarCommand Default()Sets the command to use the default style.
Returns
The current instance of the type.
public SidebarCommand Primary()Sets the command to use the primary style.
Returns
The current instance of the type.
public SidebarCommand Success()Sets the command to use the success style.
Returns
The current instance of the type.
public SidebarCommand Danger()Sets the command to use the danger style.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Tooltip(string) | Sets a tooltip for the command. |
| Tooltip(IComponent) | Sets a tooltip component for the command. |
| Tooltip(Func<IComponent>) | Sets a tooltip generator function for the command. |
Tooltip(string)
public SidebarCommand Tooltip(string text)Sets a tooltip for the command.
Parameters
- text string
- The tooltip text.
Returns
The current instance of the type.
public SidebarCommand OnClickMenu(Func<ISidebarItem[]> generator)Configures the command to show a menu when clicked.
Parameters
- generator
- A function that generates the sidebar items for the menu.
Returns
The current instance of the type.
public SidebarCommand RaiseOnClick(MouseEvent mouseEvent)Programmatically raises the click event.
Parameters
- mouseEvent
- The mouse event arguments.
Returns
The current instance of the type.
public SidebarCommand RaiseOnContextMenu(MouseEvent mouseEvent)Programmatically raises the context menu event.
Parameters
- mouseEvent
- The mouse event arguments.
Returns
The current instance of the type.
| Overload | |
|---|---|
| OnClick(Action) | Adds a click event handler. |
| OnClick(Action<Button, MouseEvent>) | Adds a click event handler with button and mouse event arguments. |
| Overload | |
|---|---|
| OnContextMenu(Action) | Adds a context menu event handler. |
| OnContextMenu(Action<Button, MouseEvent>) | Adds a context menu event handler with button and mouse event arguments. |
| Overload | |
|---|---|
| SetIcon(UIcons, string, UIconsWeight) | Sets the icon for the command. |
| SetIcon(Emoji) | Sets an emoji icon for the command. |
SetIcon(UIcons, string, UIconsWeight)
public SidebarCommand SetIcon(UIcons icon, string color = "", UIconsWeight weight = UIconsWeight.Regular)Sets the icon for the command.
Parameters
- icon UIcons
- The icon.
- color string
- The color of the icon.
- weight UIconsWeight
- The weight of the icon.
Returns
The current instance of the type.
public class SidebarCommands : ISidebarItemA component for grouping multiple SidebarCommand items into a single line within a Sidebar.
- Namespace
- Tesserae
- Implements
- ISidebarItem
Properties
| Name | Description |
|---|---|
| IsSelected | Gets or sets whether the group is currently selected. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the command group. |
| OwnIdentifier | Gets the own identifier of the command group. |
public bool IsSelected { get; set; }Gets or sets whether the group is currently selected.
public IComponent CurrentRendered { get; private set; }Gets the component that is currently rendered.
public string Identifier { get; private set; }Gets the full identifier of the command group.
Methods
| Name | Description |
|---|---|
| RenderOpen | Renders the commands for the open state of the sidebar. |
| Show | Shows the commands. |
| Collapse | Collapses the commands. |
| RenderOpenFull | Renders all commands for the open state without truncation. |
| RenderClosed | Renders the commands for the closed state of the sidebar. |
| AlignEnd | Aligns the commands to the end of the line. |
| NotSortable | Marks the commands as not sortable. |
| AddGroupIdentifier | Adds a group identifier prefix to the command group's identifier. |
public IComponent RenderOpen()Renders the commands for the open state of the sidebar.
public IComponent RenderOpenFull()Renders all commands for the open state without truncation.
public IComponent RenderClosed()Renders the commands for the closed state of the sidebar.
public SidebarCommands AlignEnd()Aligns the commands to the end of the line.
Returns
The current instance of the type.
public SidebarCommands NotSortable()Marks the commands as not sortable.
Returns
The current instance of the type.
public class SidebarText : ISidebarItemA Text component for use within a Sidebar, supporting both open and closed states.
- Namespace
- Tesserae
- Implements
- ISidebarItem
Constructors
| Name | Description |
|---|---|
| SidebarText | Initializes a new instance of the SidebarText class. |
public SidebarText(string identifier, string text, string closedText = null, TextSize textSize = TextSize.Small, TextWeight textWeight = TextWeight.Regular)Initializes a new instance of the SidebarText class.
Parameters
- identifier
- The identifier for the text item.
- text
- The text to display when the sidebar is open.
- closedText
- The optional text to display when the sidebar is closed.
- textSize
- The size of the text.
- textWeight
- The weight of the text.
Properties
| Name | Description |
|---|---|
| CurrentRendered | Gets the component that is currently rendered. |
| IsSelected | Gets or sets whether the item is currently selected. |
| Identifier | Gets the full identifier of the text component. |
| OwnIdentifier | Gets the own identifier of the text component. |
public IComponent CurrentRenderedGets the component that is currently rendered.
public bool IsSelected { get; set; }Gets or sets whether the item is currently selected.
public string Identifier { get; private set; }Gets the full identifier of the text component.
Methods
| Name | Description |
|---|---|
| Show | Shows the text component. |
| Collapse | Collapses the text component. |
| NotSortable | Marks the text component as not sortable. |
| AddGroupIdentifier | Adds a group identifier prefix to the text component's identifier. |
| SetText | Sets the text content for the open state. |
| Foreground | Sets the foreground color of the text. |
| PT | Sets the top padding of the text. |
| PB | Sets the bottom padding of the text. |
| PL | Sets the left padding of the text. |
| RenderClosed | Renders the text for the closed state of the sidebar. |
| RenderOpen | Renders the text for the open state of the sidebar. |
public SidebarText NotSortable()Marks the text component as not sortable.
Returns
The current instance of the type.
public void AddGroupIdentifier(string groupIdentifier)Adds a group identifier prefix to the text component's identifier.
public SidebarText SetText(string text)Sets the text content for the open state.
Parameters
- text
- The text.
Returns
The current instance of the type.
public SidebarText Foreground(string color)Sets the foreground color of the text.
Parameters
- color
- The color.
Returns
The current instance of the type.
public SidebarText PT(int pixels)Sets the top padding of the text.
Parameters
- pixels
- The padding in pixels.
Returns
The current instance of the type.
public SidebarText PB(int pixels)Sets the bottom padding of the text.
Parameters
- pixels
- The padding in pixels.
Returns
The current instance of the type.
public SidebarText PL(int pixels)Sets the left padding of the text.
Parameters
- pixels
- The padding in pixels.
Returns
The current instance of the type.
public IComponent RenderClosed()Renders the text for the closed state of the sidebar.
public class SidebarBadge : IComponentA Badge component for sidebar items, often used to display counts or status indicators.
- Namespace
- Tesserae
- Implements
- IComponent
Constructors
| Name | Description |
|---|---|
| SidebarBadge | Initializes a new instance of the SidebarBadge class. |
| Overload | |
|---|---|
| SidebarBadge(string, UIcons, TextSize) | Initializes a new instance of the SidebarBadge class. |
| SidebarBadge(string, UIcons) | Initializes a new instance of the SidebarBadge class. |
| SidebarBadge(string) | Initializes a new instance of the SidebarBadge class. |
| SidebarBadge(ISidebarIcon) | Initializes a new instance of the SidebarBadge class with an image. |
SidebarBadge(string, UIcons, TextSize)
public SidebarBadge(string badge, UIcons badgeIcon, TextSize iconSize = TextSize.Tiny)Initializes a new instance of the SidebarBadge class.
Parameters
- badge string
- The text content of the badge.
- badgeIcon UIcons
- An optional icon for the badge.
- iconSize TextSize
- The size of the icon.
SidebarBadge(string, UIcons)
public SidebarBadge(string badge, UIcons badgeIcon)Initializes a new instance of the SidebarBadge class.
Parameters
- badge string
- The text content of the badge.
- badgeIcon UIcons
- An optional icon for the badge.
Methods
| Name | Description |
|---|---|
| SemiTransparent | Sets the badge icon to be semi-transparent. |
| Foreground | Sets the foreground color of the badge. |
| Background | Sets the background color of the badge. |
| Default | Sets the badge to use the default style. |
| Primary | Sets the badge to use the primary style. |
| Success | Sets the badge to use the success style. |
| Danger | Sets the badge to use the danger style. |
| Tooltip | Sets a tooltip for the badge. |
| SetIcon | Sets the icon for the badge. |
| SetBadge | Sets the text content of the badge. |
| Render | Renders the sidebar badge. |
public SidebarBadge SemiTransparent()Sets the badge icon to be semi-transparent.
Returns
The current instance of the type.
public SidebarBadge Foreground(string color)Sets the foreground color of the badge.
Parameters
- color
- The color.
Returns
The current instance of the type.
public SidebarBadge Background(string color)Sets the background color of the badge.
Parameters
- color
- The color.
Returns
The current instance of the type.
public SidebarBadge Default()Sets the badge to use the default style.
Returns
The current instance of the type.
public SidebarBadge Primary()Sets the badge to use the primary style.
Returns
The current instance of the type.
public SidebarBadge Success()Sets the badge to use the success style.
Returns
The current instance of the type.
public SidebarBadge Danger()Sets the badge to use the danger style.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Tooltip(string) | Sets a tooltip for the badge. |
| Tooltip(IComponent) | Sets a tooltip component for the badge. |
| Tooltip(Func<IComponent>) | Sets a tooltip generator function for the badge. |
Tooltip(string)
public SidebarBadge Tooltip(string text)Sets a tooltip for the badge.
Parameters
- text string
- The tooltip text.
Returns
The current instance of the type.
| Overload | |
|---|---|
| SetIcon(UIcons, string, UIconsWeight) | Sets the icon for the badge. |
| SetIcon(Emoji) | Sets an emoji icon for the badge. |
SetIcon(UIcons, string, UIconsWeight)
public SidebarBadge SetIcon(UIcons icon, string color = "", UIconsWeight weight = UIconsWeight.Regular)Sets the icon for the badge.
Parameters
- icon UIcons
- The icon.
- color string
- The color of the icon.
- weight UIconsWeight
- The weight of the icon.
Returns
The current instance of the type.
public SidebarBadge SetBadge(string badge)Sets the text content of the badge.
Parameters
- badge
- The badge text.
Returns
The current instance of the type.