Sidebar
Description
A sidebar navigation component
A fully featured Sidebar with Search, Navigation, Buttons, and Separators.
A sidebar can also shift into a second sidebar instead of being torn down and rebuilt, which is what navigating into an interface that has navigation of its own (a chat view, a project workspace) usually needs. ShiftTo(child) slides the track sideways by one full width to the child's panel, ShiftBack() returns, IsShifted / ShiftedSidebar read the state and OnShiftChanged reports it. The child renders inside the host and follows its open/closed state; the panel that ends up out of view is taken out of the tab and reading order once the transition finishes. It is one level deep, and ignored while the sidebar renders as a navbar.
A collapsed SidebarNav expands itself when a child, or a nested descendant, becomes selected, and scrolls the item into view, so the row marking the current page cannot sit invisible inside a closed group. Only selection changes trigger it: the user can still collapse the group by hand while the same item stays selected. Observe selection yourself through SidebarButton.SelectedStatus / SidebarNav.SelectedStatus (both IObservable<bool>), and opt a group out of the automatic expansion with KeepCollapsedOnSelection().
SidebarSearchBox can be driven by its host: Text / SetText(...) write into the box without raising OnSearch, and Focus() puts the caret in it.
Sample
API reference
public sealed class Sidebar : IComponent, IBindableComponent<bool>A Sidebar component that can be collapsed or expanded, containing header, middle, and footer sections.
- Namespace
- Tesserae
- Implements
- IComponent, IBindableComponent<bool>
Constructors
| Name | Description |
|---|---|
| Sidebar | Initializes a new instance of the Sidebar class. |
Properties
| Name | Description |
|---|---|
| IsClosed | Gets or sets whether the sidebar is closed. |
| IsNavbar | Gets whether the sidebar is currently rendering as a navbar. |
| IsPage | Gets whether the sidebar is currently rendering as a page - see AsPage. |
| PageMode | Observes whether the sidebar renders as a page - see AsPage. |
| IsShowingContent | Gets whether a sidebar rendering as a page has stepped aside for the content next to it. Always false while the sidebar is not a page. |
| ShowingContent | Observes whether a sidebar rendering as a page has stepped aside for the content (true) or is the page on screen (false). |
| IsShifted | Gets whether the sidebar is currently showing the shifted (child) sidebar. |
| ShiftedSidebar | Gets the child sidebar that is currently mounted for shifting, if any. |
public bool IsClosed { get ; set ; }Gets or sets whether the sidebar is closed.
public bool IsPageGets whether the sidebar is currently rendering as a page - see AsPage.
public IObservable<bool> PageModeObserves whether the sidebar renders as a page - see AsPage.
public bool IsShowingContentGets whether a sidebar rendering as a page has stepped aside for the content next to it. Always false while the sidebar is not a page.
public IObservable<bool> ShowingContentObserves whether a sidebar rendering as a page has stepped aside for the content (true) or is the page on screen (false).
public bool IsShiftedGets whether the sidebar is currently showing the shifted (child) sidebar.
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 - a horizontal bar with a hamburger that opens the items in a sliding drawer - or back to an ordinary vertical sidebar. |
| AsPage | Configures the sidebar to render as a page - the phone layout where the sidebar and the content next to it take turns filling the screen - or back to an ordinary sidebar. |
| ShowContent | Steps a sidebar rendering as a page aside, so the content next to it fills the screen. Does nothing visible while the sidebar is not a page, beyond remembering it for when it becomes one. |
| ShowSidebar | Brings a sidebar rendering as a page back in place of the content - the back button of SidebarPageBar. |
| Closed | Sets whether the sidebar is closed. |
| Toggle | Toggles the closed state of the sidebar. |
| ShiftTo | Slides horizontally into a child sidebar, used when navigating into an interface that has its own sidebar. The child sidebar is rendered inside this one and follows its open/closed state. Only one depth level is supported: shifting into another child replaces the current one. Call ShiftBack to slide back into this sidebar. |
| ShiftBack | Slides back from the child sidebar into this sidebar. |
| OnShiftChanged | Adds a handler that is called whenever the sidebar shifts into the child sidebar (true) or back (false). |
| 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. |
| AsObservable | Returns an observable that tracks the closed/open state of the sidebar. |
| SetBoundValue | Programmatically opens or closes the sidebar as part of a two-way binding. |
| 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. |
| WithGroupIdentifier | Stamps an item's identifier with the group it is being placed in, unless it already carries it. |
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 AsPage(bool isPage = true)Configures the sidebar to render as a page - the phone layout where the sidebar and the content next to it take turns filling the screen - or back to an ordinary sidebar.
Parameters
- isPage
- Whether to render as a page.
Returns
The current instance.
Remarks
As a page the sidebar is always open and fills its container, and everything after it in that container is hidden. Picking one of its buttons steps it aside (ShowContent), which hides the sidebar and brings the content back; ShowSidebar is the way back, and SidebarPageBar is a bar for the content that carries the button doing it. The open/closed state is kept rather than cleared, so a sidebar that stops being a page returns to the rail the user left. Follow OnMobileModeChanged to switch on a resize.
public Sidebar ShowContent()Steps a sidebar rendering as a page aside, so the content next to it fills the screen. Does nothing visible while the sidebar is not a page, beyond remembering it for when it becomes one.
Returns
The current instance.
public Sidebar ShowSidebar()Brings a sidebar rendering as a page back in place of the content - the back button of SidebarPageBar.
Returns
The current instance.
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 ShiftTo(Sidebar child)Slides horizontally into a child sidebar, used when navigating into an interface that has its own sidebar. The child sidebar is rendered inside this one and follows its open/closed state. Only one depth level is supported: shifting into another child replaces the current one. Call ShiftBack to slide back into this sidebar.
Parameters
- child
- The sidebar to shift into.
Returns
The current instance of the type.
public Sidebar ShiftBack()Slides back from the child sidebar into this sidebar.
Returns
The current instance of the type.
public Sidebar OnShiftChanged(Action<bool> onShiftChanged)Adds a handler that is called whenever the sidebar shifts into the child sidebar (true) or back (false).
Parameters
- onShiftChanged
- The event handler.
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 IObservable<bool> AsObservable()Returns an observable that tracks the closed/open state of the sidebar.
public void SetBoundValue(bool value)Programmatically opens or closes the sidebar as part of a two-way binding.
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.
public static string GetOwnIdentifier(string identifier)Gets the own identifier of an item by removing group identifier prefix.
Parameters
- identifier
- The full identifier.
Returns
The own identifier.
public static string WithGroupIdentifier(string identifier, string groupIdentifier)Stamps an item's identifier with the group it is being placed in, unless it already carries it.
Parameters
- identifier
- The item's current identifier.
- groupIdentifier
- The group the item is being placed in.
Returns
The identifier as it reads inside that group.
Remarks
The stamped identifier is how an item is found again once it is placed, so stamping twice would leave it unfindable. That happens whenever an item is placed, taken out and placed back, and whenever a caller hands in a freshly built item for a method that has to match the one already there - which is why every method that matches an identifier normalises through this first.
Fields
| Name | Description |
|---|---|
| SIDEBAR_TRANSITION_TIME | The transition time for sidebar animations in milliseconds. |
| SIDEBAR_SHIFT_TRANSITION_TIME | How long shifting into a child sidebar and back takes - half the time the sidebar's own open/close animation takes, since both places are already there and the move wants to feel immediate. Kept in step with the transition on .tss-sidebar-shift-track in tss.sidebar.css. |
| NAV_OVERLAY_PEEK | How far each panel behind the front one steps left, in pixels - the strip of it that shows. |
| NAV_OVERLAY_MAX_PEEK_DEPTH | How many panels behind the front one still peek out; deeper ones sit behind the last of them. |
| 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 int SIDEBAR_SHIFT_TRANSITION_TIME = 150How long shifting into a child sidebar and back takes - half the time the sidebar's own open/close animation takes, since both places are already there and the move wants to feel immediate. Kept in step with the transition on .tss-sidebar-shift-track in tss.sidebar.css.
private const int NAV_OVERLAY_PEEK = 12How far each panel behind the front one steps left, in pixels - the strip of it that shows.
private const int NAV_OVERLAY_MAX_PEEK_DEPTH = 3How many panels behind the front one still peek out; deeper ones sit behind the last of them.
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. |
| SelectedStatus | Gets an observable for the selected status. |
| 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 IObservable<bool> SelectedStatusGets an observable for the selected status.
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. |
| ReserveRoomForCommands | Marks the row as one that has commands, and says how wide its strip of them is - each is a 22px button with a 4px gap between them. Only the row knows how many it has, so it writes both here and the stylesheet reads them back to lay the label out beside the strip wherever the strip is permanent - always-visible, or selected. On hover the label keeps the full width of the rail and fades out into the row where the commands begin instead (see tss-sidebar-has-commands and the scrim on it in tss.sidebar.css). |
| TrackBadgeWidth | Marks the row as one that carries a badge, and keeps how wide the badge is up to date. A badge is drawn over the row's right edge the way the commands are, so the name has to give way to it or a long one runs underneath the glyph - which is what a shared-space icon sitting on the last letters of the space's name was. The stylesheet keeps room for it at rest and fades the name out into it under the pointer, and both are sized from how wide the badge is. Unlike the commands there is no count to compute that from - a badge is an icon, or "+3", or "+1,204" - so it is measured, and re-measured whenever its text changes, and written where the stylesheet reads it back (see tss-sidebar-has-badge in tss.sidebar.css). The badge is hidden with visibility rather than display where the commands take its place, so the measurement stays true. |
| 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. |
| Rounded | Renders the button with rounded corners (defaults to a fully rounded "pill" shape), matching the rounded SidebarSearchBox style. |
| Outlined | Draws the button with a field's chrome - a border and the secondary surface behind it - instead of as a bare row. What a rail's own action wants when it stands next to a search box: the same outline, so the two read as a pair of controls rather than as a button beside a form field. Only the open button takes it; around a single glyph on the closed rail an outline is just a box. |
| AsSearchBox | Dresses the button as a search field: a rounded outline, the label set as a placeholder rather than as a label, and - when keys are given - the shortcut that reaches it shown at the far end. For a search that answers somewhere else, which is most of them now: what the box would be for happens in a palette or on a page, so the thing on the rail only has to look like where a search starts and be pressable. A real input would take a caret it has nothing to do with. |
| SetKeyboardShortcut | Shows the shortcut that presses this button at its far end, and answers that shortcut for as long as the button is on screen - which is what makes the chip a promise rather than a note. The keys are the ones KeyboardShortcut displays, so ("Ctrl", "Shift", "O") reads Ctrl+Shift+O and triggers on ⌘⇧O on a Mac. Only the open button carries the chip - the closed rail has room for the glyph and nothing else - but the key works on either, because a collapsed rail is a smaller rail and not a different one. A button that is nowhere on screen holds no shortcut: there is nothing for the key to press. |
| ShortcutOnlyOnHover | Keeps the shortcut chip out of sight until the pointer is on the row - or something inside it has focus, so a row reached by tabbing shows its key too. The binding is untouched: the key works the same whether or not the chip is on screen. For a rail where most rows carry a key: all the chips at once read as a column of noise beside the labels, while one chip on the row being pointed at is still how the key gets discovered. The room at the end stays reserved either way, so a label does not re-flow as the chip appears. |
| ButtonOnScreen | Whichever of the two renderings the user can actually see, or null when neither is. Mounted is not enough on its own: both are mounted at once while the sidebar hides the one it is not showing, and a collapsed button is mounted too. |
| Danger | Sets the button to use a danger style. |
| Warning | Sets the button to use a warning 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.
private static void ReserveRoomForCommands(HTMLElement wrapper, int commandCount)Marks the row as one that has commands, and says how wide its strip of them is - each is a 22px button with a 4px gap between them. Only the row knows how many it has, so it writes both here and the stylesheet reads them back to lay the label out beside the strip wherever the strip is permanent - always-visible, or selected. On hover the label keeps the full width of the rail and fades out into the row where the commands begin instead (see tss-sidebar-has-commands and the scrim on it in tss.sidebar.css).
private void TrackBadgeWidth(HTMLElement wrapper, HTMLElement badges)Marks the row as one that carries a badge, and keeps how wide the badge is up to date. A badge is drawn over the row's right edge the way the commands are, so the name has to give way to it or a long one runs underneath the glyph - which is what a shared-space icon sitting on the last letters of the space's name was. The stylesheet keeps room for it at rest and fades the name out into it under the pointer, and both are sized from how wide the badge is. Unlike the commands there is no count to compute that from - a badge is an icon, or "+3", or "+1,204" - so it is measured, and re-measured whenever its text changes, and written where the stylesheet reads it back (see tss-sidebar-has-badge in tss.sidebar.css). The badge is hidden with visibility rather than display where the commands take its place, so the measurement stays true.
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 Rounded(BorderRadius radius = BorderRadius.Full)Renders the button with rounded corners (defaults to a fully rounded "pill" shape), matching the rounded SidebarSearchBox style.
Parameters
- radius
- The border radius to apply. Defaults to
Full.
Returns
The current instance of the type.
public SidebarButton Outlined()Draws the button with a field's chrome - a border and the secondary surface behind it - instead of as a bare row. What a rail's own action wants when it stands next to a search box: the same outline, so the two read as a pair of controls rather than as a button beside a form field. Only the open button takes it; around a single glyph on the closed rail an outline is just a box.
Returns
The current instance of the type.
public SidebarButton AsSearchBox(params string[] shortcutKeys)Dresses the button as a search field: a rounded outline, the label set as a placeholder rather than as a label, and - when keys are given - the shortcut that reaches it shown at the far end. For a search that answers somewhere else, which is most of them now: what the box would be for happens in a palette or on a page, so the thing on the rail only has to look like where a search starts and be pressable. A real input would take a caret it has nothing to do with.
Parameters
- shortcutKeys
- The keys to show at the end, e.g.
("Ctrl", "K"). None hides it. The chip is a label only - useSetKeyboardShortcutfor the key to press the button as well, which a search that answers somewhere else usually does not want: the palette or page it opens owns that key, and answers it from inside a text field too, where a button's shortcut steps aside.
public SidebarButton SetKeyboardShortcut(params string[] keys)Shows the shortcut that presses this button at its far end, and answers that shortcut for as long as the button is on screen - which is what makes the chip a promise rather than a note. The keys are the ones KeyboardShortcut displays, so ("Ctrl", "Shift", "O") reads Ctrl+Shift+O and triggers on ⌘⇧O on a Mac. Only the open button carries the chip - the closed rail has room for the glyph and nothing else - but the key works on either, because a collapsed rail is a smaller rail and not a different one. A button that is nowhere on screen holds no shortcut: there is nothing for the key to press.
Parameters
- keys
- The keys, e.g.
("Ctrl", "Shift", "O"). None removes chip and binding.
public SidebarButton ShortcutOnlyOnHover(bool onlyOnHover = true)Keeps the shortcut chip out of sight until the pointer is on the row - or something inside it has focus, so a row reached by tabbing shows its key too. The binding is untouched: the key works the same whether or not the chip is on screen. For a rail where most rows carry a key: all the chips at once read as a column of noise beside the labels, while one chip on the row being pointed at is still how the key gets discovered. The room at the end stays reserved either way, so a label does not re-flow as the chip appears.
Parameters
- onlyOnHover
- Whether the chip waits for a hover. False shows it at all times, the default.
private Button ButtonOnScreen()Whichever of the two renderings the user can actually see, or null when neither is. Mounted is not enough on its own: both are mounted at once while the sidebar hides the one it is not showing, and a collapsed button is mounted too.
public SidebarButton Danger()Sets the button to use a danger style.
Returns
The current instance of the type.
public SidebarButton Warning()Sets the button to use a warning 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
Properties
| Name | Description |
|---|---|
| Text | The text in the box. Setting it does not raise OnSearch - a caller that clears the box usually has its own idea of what to do about the results. |
Methods
| Name | Description |
|---|---|
| Rounded | Renders the search box with rounded corners (defaults to a fully rounded "pill" shape, like the rounded SidebarButton). Removes the underlined style so the box shows a full rounded border. |
| SetText | Sets the text in the box, without raising OnSearch. |
| Focus | Puts the caret in the box. |
| OnClick | Makes the box a way in rather than a place to type: clicking it - open, or as the icon on the closed rail - runs the handler, and so does focusing it, which is what SetKeyboardShortcut does. Nothing can be typed into it, because what is typed belongs to whatever the handler opened. This is the shape a search that answers somewhere else takes: the box says where to start and which key gets there, and a palette or a page does the searching. |
| ShortcutOnlyOnHover | Keeps the shortcut chip out of sight until the pointer is on the box - or the caret is in it, so a box reached by tabbing shows its key too. The binding is untouched: the key works the same whether or not the chip is on screen. The room the chip takes at the end is reserved either way, so what is typed does not re-flow as the chip appears. |
public SidebarSearchBox Rounded(BorderRadius radius = BorderRadius.Full)Renders the search box with rounded corners (defaults to a fully rounded "pill" shape, like the rounded SidebarButton). Removes the underlined style so the box shows a full rounded border.
Parameters
- radius
- The border radius to apply. Defaults to
Full.
Returns
The current instance of the type.
public SidebarSearchBox SetText(string text)Sets the text in the box, without raising OnSearch.
public SidebarSearchBox OnClick(Action onClick)Makes the box a way in rather than a place to type: clicking it - open, or as the icon on the closed rail - runs the handler, and so does focusing it, which is what SetKeyboardShortcut does. Nothing can be typed into it, because what is typed belongs to whatever the handler opened. This is the shape a search that answers somewhere else takes: the box says where to start and which key gets there, and a palette or a page does the searching.
public SidebarSearchBox ShortcutOnlyOnHover(bool onlyOnHover = true)Keeps the shortcut chip out of sight until the pointer is on the box - or the caret is in it, so a box reached by tabbing shows its key too. The binding is untouched: the key works the same whether or not the chip is on screen. The room the chip takes at the end is reserved either way, so what is typed does not re-flow as the chip appears.
Parameters
- onlyOnHover
- Whether the chip waits for a hover. False shows it at all times, the default.
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. |
| Warning | Sets the command to use the warning 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.
public SidebarCommand Warning()Sets the command to use the warning 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. |
| Warning | Sets the badge to use the warning 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.
public SidebarBadge Warning()Sets the badge to use the warning 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.
SidebarBrand
The row at the top of a rail that names the application: a logo, its name and an optional second line (workspace, tenant, environment). It has the same shape and height as SidebarProfile, and can also be the control that collapses and expands the rail.
public class SidebarBrand : SidebarIdentityRow<SidebarBrand>The row at the top of a rail that says what the application is: a logo, its name, and an optional second line for whatever qualifies that name - the workspace, the tenant, the environment. It is the same shape and height as SidebarProfile, so a rail bracketed by the two reads as one piece of chrome. It can also be the one control that collapses and expands the rail - see WithSidebarControl. On the collapsed rail the row is the logo alone, with the name (and the second line) in its tooltip. The open rail is never narrower than the name and the second line need, so neither is ellipsized: the row measures its text and raises the sidebar's min-width to fit it.
- Namespace
- Tesserae
- Inheritance
- SidebarIdentityRow<SidebarBrand> → SidebarBrand
Constructors
| Name | Description |
|---|---|
| SidebarBrand | Initializes a new instance of the SidebarBrand class, with a logo loaded from a URL. |
| Overload | |
|---|---|
| SidebarBrand(string, string, string, string) | Initializes a new instance of the SidebarBrand class, with a logo loaded from a URL. |
| SidebarBrand(string, UIcons, string, string, UIconsWeight) | Initializes a new instance of the SidebarBrand class, with a glyph in place of a logo. |
| SidebarBrand(string, Emoji, string, string) | Initializes a new instance of the SidebarBrand class, with an emoji in place of a logo. |
| SidebarBrand(string, ISidebarIcon, string, string) | Initializes a new instance of the SidebarBrand class, with a logo of the caller's own. |
SidebarBrand(string, string, string, string)
public SidebarBrand(string identifier, string title, string subtitle = null, string logoUrl = null) : this(identifier, LogosFor(logoUrl), title, subtitle)Initializes a new instance of the SidebarBrand class, with a logo loaded from a URL.
Parameters
- identifier string
- The identifier for the item.
- title string
- The application's name.
- subtitle string
- What qualifies the name - the workspace, the tenant, the environment. None leaves the row a single line.
- logoUrl string
- The logo's URL. None leaves the row without one.
SidebarBrand(string, UIcons, string, string, UIconsWeight)
public SidebarBrand(string identifier, UIcons icon, string title, string subtitle = null, UIconsWeight weight = UIconsWeight.Regular) : this(identifier, new IComponent[] { Icon(icon, weight, TextSize.Medium), Icon(icon, weight, TextSize.Medium) }, title, subtitle)Initializes a new instance of the SidebarBrand class, with a glyph in place of a logo.
Parameters
- identifier string
- The identifier for the item.
- icon UIcons
- The glyph.
- title string
- The application's name.
- subtitle string
- What qualifies the name. None leaves the row a single line.
- weight UIconsWeight
- The glyph's weight.
SidebarBrand(string, Emoji, string, string)
public SidebarBrand(string identifier, Emoji icon, string title, string subtitle = null) : this(identifier, new IComponent[] { Icon(icon, TextSize.Medium), Icon(icon, TextSize.Medium) }, title, subtitle)Initializes a new instance of the SidebarBrand class, with an emoji in place of a logo.
Parameters
- identifier string
- The identifier for the item.
- icon Emoji
- The emoji.
- title string
- The application's name.
- subtitle string
- What qualifies the name. None leaves the row a single line.
SidebarBrand(string, ISidebarIcon, string, string)
public SidebarBrand(string identifier, ISidebarIcon logo, string title, string subtitle = null) : this(identifier, new IComponent[] { logo, logo.Clone() }, title, subtitle)Initializes a new instance of the SidebarBrand class, with a logo of the caller's own.
Parameters
- identifier string
- The identifier for the item.
- logo ISidebarIcon
- The logo. It is cloned for the collapsed rail, since one element cannot be in two places.
- title string
- The application's name.
- subtitle string
- What qualifies the name. None leaves the row a single line.
Methods
| Name | Description |
|---|---|
| WrapLogo | A box of its own around whatever the logo is, so that an image, a glyph and an emoji all take the same square beside the name - the stylesheet sizes the box rather than each of the three. |
| SetTitle | Sets the application's name. |
| SetBadge | Puts a badge after the application's name - the environment it runs in ("DEV", "VAL"), an edition, a pre-release marker - in the colours of a Badge of the same tone. The badge stays whole and the name ellipsizes before it, and the open rail grows to fit both. On the collapsed rail its text joins the name in the logo's default tooltip. Null or empty text removes it. |
| Configure | Adds the command that opens the application's configuration. |
| WithSidebarControl | Makes the brand the rail's own open/close control, which is where an application that has one usually wants it: at the top, on the row that is there in both states. While the sidebar is open it is the last command on the row, so closing the rail is the rightmost thing on it. While the sidebar is closed there is no room for a command beside the logo, so the logo is the control: it stands as the brand at rest and turns into the open button under the pointer. The row reports the two intentions rather than driving a sidebar itself, because the rail a brand sits on is not always the one it opens - an application shifts between rails, and rebuilds them - so the caller is the one that knows which Sidebar to toggle and what else follows from it. |
private static IComponent WrapLogo(IComponent logo)A box of its own around whatever the logo is, so that an image, a glyph and an emoji all take the same square beside the name - the stylesheet sizes the box rather than each of the three.
public SidebarBrand SetTitle(string title)Sets the application's name.
Parameters
- title
- The name.
Returns
The current instance of the type.
| Overload | |
|---|---|
| SetBadge(string, BadgeTone) | Puts a badge after the application's name - the environment it runs in ("DEV", "VAL"), an edition, a pre-release marker - in the colours of a Badge of the same tone. The badge stays whole and the name ellipsizes before it, and the open rail grows to fit both. On the collapsed rail its text joins the name in the logo's default tooltip. Null or empty text removes it. |
| SetBadge(Badge) | Puts a badge of the caller's own after the application's name - for one with an icon, an outline or colours outside the tones (Background, Foreground). Passing null removes it. |
SetBadge(string, BadgeTone)
public SidebarBrand SetBadge(string text, BadgeTone tone = BadgeTone.Neutral)Puts a badge after the application's name - the environment it runs in ("DEV", "VAL"), an edition, a pre-release marker - in the colours of a Badge of the same tone. The badge stays whole and the name ellipsizes before it, and the open rail grows to fit both. On the collapsed rail its text joins the name in the logo's default tooltip. Null or empty text removes it.
Parameters
- text string
- What the badge says.
- tone BadgeTone
- Its colour, as
Tonetakes it. Neutral by default.
Returns
The current instance of the type.
SetBadge(Badge)
public SidebarBrand SetBadge(Badge badge)Puts a badge of the caller's own after the application's name - for one with an icon, an outline or colours outside the tones (Background, Foreground). Passing null removes it.
Parameters
- badge Badge
- The badge.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Configure(Action, string, UIcons) | Adds the command that opens the application's configuration. |
| Configure(SidebarCommand) | Sets the configuration command, built by the caller - for one that opens a menu (OnClickMenu) rather than a page. Passing null removes it. |
Configure(Action, string, UIcons)
public SidebarBrand Configure(Action onClick, string tooltip = null, UIcons icon = UIcons.Settings)Adds the command that opens the application's configuration.
Parameters
- onClick Action
- What pressing it does.
- tooltip string
- The tooltip. None uses "Settings".
- icon UIcons
- The icon. Defaults to a gear.
Returns
The current instance of the type.
Configure(SidebarCommand)
public SidebarBrand Configure(SidebarCommand command)Sets the configuration command, built by the caller - for one that opens a menu (OnClickMenu) rather than a page. Passing null removes it.
Parameters
- command SidebarCommand
- The command.
Returns
The current instance of the type.
public SidebarBrand WithSidebarControl( Action onOpen, Action onClose, string openTooltip = null, string closeTooltip = null, UIcons openIcon = UIcons.SidebarFlip, UIcons closeIcon = UIcons.Sidebar)Makes the brand the rail's own open/close control, which is where an application that has one usually wants it: at the top, on the row that is there in both states. While the sidebar is open it is the last command on the row, so closing the rail is the rightmost thing on it. While the sidebar is closed there is no room for a command beside the logo, so the logo is the control: it stands as the brand at rest and turns into the open button under the pointer. The row reports the two intentions rather than driving a sidebar itself, because the rail a brand sits on is not always the one it opens - an application shifts between rails, and rebuilds them - so the caller is the one that knows which Sidebar to toggle and what else follows from it.
Parameters
- onOpen
- What opening the rail does. Called from the control the collapsed rail shows.
- onClose
- What closing it does. Called from the last command on the open row.
- openTooltip
- The tooltip on the open control. None uses "Open Sidebar".
- closeTooltip
- The tooltip on the close command. None uses "Close Sidebar".
- openIcon
- The icon of the open control. The rail's own glyph, mirrored.
- closeIcon
- The icon of the close command. The rail's own glyph.
Returns
The current instance of the type.
SidebarProfile
The row that says who is signed in: a picture (falling back to the account's initials), a name, an optional second line, and the account's commands such as settings and signing out. On the collapsed rail it shows the picture alone.
public class SidebarProfile : SidebarIdentityRow<SidebarProfile>The row that says who is signed in: a picture, a name, an optional second line for whatever identifies the account beside the name - an e-mail address, a company, a tenant - and the commands that belong to it, settings and signing out. The picture falls back to the account's initials, so a photo URL that only answers for accounts that have uploaded one can be passed unconditionally. On the collapsed rail the row is that picture alone, with the name and the second line in its tooltip.
- Namespace
- Tesserae
- Inheritance
- SidebarIdentityRow<SidebarProfile> → SidebarProfile
Constructors
| Name | Description |
|---|---|
| SidebarProfile | Initializes a new instance of the SidebarProfile class. |
public SidebarProfile(string identifier, string name, string subtitle = null, string pictureUrl = null, string initials = null) : this(identifier, name, subtitle, InitialAvatars(pictureUrl, string.IsNullOrWhiteSpace(initials) ? InitialsFor(name) : initials))Initializes a new instance of the SidebarProfile class.
Parameters
- identifier
- The identifier for the item.
- name
- The name to show on the first line.
- subtitle
- What identifies the account beside the name - an e-mail address, a company, a tenant. None leaves the row a single line.
- pictureUrl
- The picture to show. None - or one that fails to load - falls back to the initials.
- initials
- The initials to fall back to. None takes them from the name.
Methods
| Name | Description |
|---|---|
| InitialAvatars | The two avatars a row needs - one for the open row, one for the collapsed rail, since a single element cannot be in two places. Built before the base constructor runs, which is what the array is for. They are the same size: the collapsed rail shows the row's picture in a box of the row's own height, not a smaller row. |
| SetName | Sets the name shown on the first line, and the initials taken from it where none were given. |
| SetPicture | Sets the picture. One that fails to load falls back to the initials, so a URL that answers only for accounts that have uploaded a photo can be passed unconditionally. |
| SetInitials | Sets the initials the picture falls back to. None - the default - takes them from the name. |
| Presence | Shows a presence dot on the picture - online, away, busy, offline. |
| Settings | Adds the command that opens the account's settings. |
| Logout | Adds the command that signs the account out. Optional: an application whose only way out is a menu item, or that has no way out at all, leaves it off. |
| InitialsFor | The initials a name falls back to when there is no picture: the first letter of the first word and of the last, so "M. Okafor" reads MO and "Okafor" reads O. Anything that is not a letter or a digit is skipped, which is what keeps an initial out of "M." and out of an emoji. |
private static Avatar[] InitialAvatars(string pictureUrl, string initials)The two avatars a row needs - one for the open row, one for the collapsed rail, since a single element cannot be in two places. Built before the base constructor runs, which is what the array is for. They are the same size: the collapsed rail shows the row's picture in a box of the row's own height, not a smaller row.
public SidebarProfile SetName(string name)Sets the name shown on the first line, and the initials taken from it where none were given.
Parameters
- name
- The name.
Returns
The current instance of the type.
public SidebarProfile SetPicture(string pictureUrl)Sets the picture. One that fails to load falls back to the initials, so a URL that answers only for accounts that have uploaded a photo can be passed unconditionally.
Parameters
- pictureUrl
- The picture URL.
Returns
The current instance of the type.
public SidebarProfile SetInitials(string initials)Sets the initials the picture falls back to. None - the default - takes them from the name.
Parameters
- initials
- The initials.
Returns
The current instance of the type.
public SidebarProfile Presence(AvatarPresence presence)Shows a presence dot on the picture - online, away, busy, offline.
Parameters
- presence
- The presence state.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Settings(Action, string, UIcons) | Adds the command that opens the account's settings. |
| Settings(SidebarCommand) | Sets the settings command, built by the caller - for one that opens a menu (OnClickMenu) rather than going straight to a settings page, or one that is an href. Passing null removes it. |
Settings(Action, string, UIcons)
public SidebarProfile Settings(Action onClick, string tooltip = null, UIcons icon = UIcons.Settings)Adds the command that opens the account's settings.
Parameters
- onClick Action
- What pressing it does.
- tooltip string
- The tooltip. None uses "Settings".
- icon UIcons
- The icon. Defaults to a gear.
Returns
The current instance of the type.
Settings(SidebarCommand)
public SidebarProfile Settings(SidebarCommand command)Sets the settings command, built by the caller - for one that opens a menu (OnClickMenu) rather than going straight to a settings page, or one that is an href. Passing null removes it.
Parameters
- command SidebarCommand
- The command.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Logout(Action, string, UIcons) | Adds the command that signs the account out. Optional: an application whose only way out is a menu item, or that has no way out at all, leaves it off. |
| Logout(SidebarCommand) | Sets the logout command, built by the caller. Passing null removes it. |
Logout(Action, string, UIcons)
public SidebarProfile Logout(Action onClick, string tooltip = null, UIcons icon = UIcons.SignOutAlt)Adds the command that signs the account out. Optional: an application whose only way out is a menu item, or that has no way out at all, leaves it off.
Parameters
- onClick Action
- What pressing it does.
- tooltip string
- The tooltip. None uses "Log out".
- icon UIcons
- The icon. Defaults to the sign-out arrow.
Returns
The current instance of the type.
public static string InitialsFor(string name)The initials a name falls back to when there is no picture: the first letter of the first word and of the last, so "M. Okafor" reads MO and "Okafor" reads O. Anything that is not a letter or a digit is skipped, which is what keeps an initial out of "M." and out of an emoji.
SidebarIdentityRow
The base shared by SidebarBrand and SidebarProfile: a row twice the height of an ordinary one, with a picture, a name, an optional second line and the commands that belong to what the row names.
public abstract class SidebarIdentityRow<T> : ISidebarItem where T : SidebarIdentityRow<T>What a SidebarBrand and a SidebarProfile have in common: a row twice the height of an ordinary one, carrying a picture, a name, an optional second line under it, and the commands that belong to whatever the row names. The two exist as components rather than as a SidebarButton dressed up because the shape is different - two lines of text against a picture, taller than the rows around it, with the commands drawn at rest rather than under the pointer. Composing that out of a button and a stack got every application as far as a stylesheet of its own overriding the rail's heights, paddings and icon sizes, which is what this replaces. On the collapsed rail both are the picture alone, with the name (and the second line) in the tooltip.
Type Parameters
- T
- The concrete row type, so the fluent methods return it.
- Namespace
- Tesserae
- Implements
- ISidebarItem
Constructors
| Name | Description |
|---|---|
| SidebarIdentityRow |
protected SidebarIdentityRow(string identifier, string rowClass, IComponent openLeading, IComponent closedLeading, string title, string subtitle)Parameters
- identifier
- The identifier for the item.
- rowClass
- The class naming the concrete row, e.g.
tss-sidebar-profile. - openLeading
- The picture shown while the sidebar is open.
- closedLeading
- The picture shown on the collapsed rail. A second instance, since one element cannot be in two places.
- title
- The name on the first line.
- subtitle
- The second line, or null for a single-line row.
Properties
| Name | Description |
|---|---|
| Self | The concrete row, so that a fluent method defined here returns the type it was called on. |
| OpenButton | The button the open row draws, for a subclass that has to reach it. |
| ClosedButton | The button the collapsed rail draws. |
| ClosedRoot | The element the collapsed rail draws, for a row that puts something else beside the picture there - see WithSidebarControl, which lays a control over it for the hover. |
| TitleText | The name on the first line. |
| SubtitleText | The second line, or an empty string when there is none. |
| IsSelected | Gets or sets whether the item is currently selected. |
| SelectedStatus | Gets an observable for the selected status. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the item, including group identifiers. |
| OwnIdentifier | Gets the own identifier of the item, without group identifiers. |
protected abstract T Self { get; }The concrete row, so that a fluent method defined here returns the type it was called on.
protected Button OpenButtonThe button the open row draws, for a subclass that has to reach it.
protected Button ClosedButtonThe button the collapsed rail draws.
protected HTMLElement ClosedRootThe element the collapsed rail draws, for a row that puts something else beside the picture there - see WithSidebarControl, which lays a control over it for the hover.
protected string SubtitleTextThe second line, or an empty string when there is none.
public bool IsSelected { get ; set ; }Gets or sets whether the item is currently selected.
public IObservable<bool> SelectedStatusGets an observable for the selected status.
public IComponent CurrentRenderedGets the component that is currently rendered.
public string Identifier { get; private set; }Gets the full identifier of the item, including group identifiers.
Methods
| Name | Description |
|---|---|
| AddGroupIdentifier | Adds a group identifier prefix to the item's identifier. |
| Show | Shows the item. |
| Collapse | Collapses the item. |
| SetSubtitle | Sets the second line - an e-mail address, a company, an environment. Null or empty leaves the row a single line rather than an empty one. |
| Commands | The commands drawn before the row's own - a search, a back arrow, the control that collapses the rail. Replaces whatever was set before. |
| CommandsOnHover | Keeps the commands out of sight until the pointer is on the row, the way an ordinary row's commands behave. The default is the other way round, because the row's commands are usually the only way to what they open. |
| Separated | Draws a divider on the row's outer edge - above a row at the bottom of the rail, below one at the top - running the full width of the sidebar rather than stopping at its padding. |
| Selected | Sets whether the row is selected - what marks the page it opens as the one being shown. |
| NotSortable | Marks the item as not sortable, which is what a row of chrome wants. |
| Class | Adds a class to both renderings of the item. |
| Tooltip | Sets the tooltip shown on the collapsed rail, where the row is the picture alone. None - the default - shows the name and the second line. |
| OnClick | Adds a click event handler to the row itself. The commands are separate buttons, so pressing one is not pressing the row. |
| OnContextMenu | Adds a context menu event handler. |
| OnRendered | Adds a rendered event handler. |
| RenderClosed | Renders the item for the closed state of the sidebar. |
| RenderOpen | Renders the item for the open state of the sidebar. |
| SetTitleText | Replaces the name on the first line. Kept protected so each row can name it for what it holds - the account's name, the product's name - and keep whatever else follows from it in step. |
| SetTitleBadge | Puts an element on the name's line, after the name - a label that qualifies the name itself rather than adding a second line under it, like the environment a brand's application runs in. The name gives way before it does: a name too long for the row is ellipsized and the label stays whole. The name and the label share a line of their own only while there is a label, so a row without one keeps exactly the markup it always had. |
| FitRailToText | Has the open rail the row sits on grow to the width its name and second line need, so neither is ellipsized - for the row whose text is what the rail is for, the application's name. The rail never shrinks below the width it was given; this only raises its floor. The row measures itself rather than asking for a number, because what the text has to share the row with - the rail's padding, the logo, the gap, the strip of commands - is the stylesheet's and a skin's to change. The room the text has now is subtracted from the rail's width, and what the text wants is added back: whatever else is on the row cancels out, and so does the rail's own width. So the answer only moves with what is on the row, and that is when it is measured: each time the open row is mounted, when the text or the commands change, and once the fonts arrive. Never on a resize - a rail being dragged wider would otherwise force a layout read and restyle the whole sidebar on every frame, to write the number it already had. |
| TitleLineWidth | The width the name's line wants: the name, and with a label after it the distance from the end of the name as drawn to the end of the label - the gap and the label, whatever a skin makes them, and the same whether or not the name is ellipsized at the moment, since the label follows it. |
| OnOpenRowRemoved | The open row comes off the rail every time the rail closes, and the collapsed picture goes on in the same pass. The floor stays then - the stylesheet ignores it on a closed rail, and the rail opens straight to it - and goes only when the row has left the rail altogether. |
| RailToFit | The sidebar the row is on, unless that is a child sidebar shifted into another (ShiftTo): a child fills its host's panel and the host owns the width, so a child's row is left to ellipsize rather than widen a rail that is not its own. |
| SetPrimaryCommand | The row's own command, drawn last - settings on a profile, configuration on a brand. |
| SetSecondaryCommand | The row's second command, drawn after the first - logging out, on a profile. |
| RefreshDefaultTooltip | The tooltip the collapsed rail gets when the caller has not set one: the name, and the second line after it where there is one. Re-applied whenever either changes, and left alone once a tooltip has been set by hand. |
public void AddGroupIdentifier(string groupIdentifier)Adds a group identifier prefix to the item's identifier.
public T SetSubtitle(string subtitle)Sets the second line - an e-mail address, a company, an environment. Null or empty leaves the row a single line rather than an empty one.
Parameters
- subtitle
- The text for the second line.
Returns
The current instance of the type.
public T Commands(params SidebarCommand[] commands)The commands drawn before the row's own - a search, a back arrow, the control that collapses the rail. Replaces whatever was set before.
Parameters
- commands
- The commands.
Returns
The current instance of the type.
public T CommandsOnHover(bool onHover = true)Keeps the commands out of sight until the pointer is on the row, the way an ordinary row's commands behave. The default is the other way round, because the row's commands are usually the only way to what they open.
Parameters
- onHover
- Whether the commands wait for a hover.
Returns
The current instance of the type.
public T Separated(bool separated = true)Draws a divider on the row's outer edge - above a row at the bottom of the rail, below one at the top - running the full width of the sidebar rather than stopping at its padding.
Parameters
- separated
- Whether to draw the divider.
Returns
The current instance of the type.
public T Selected(bool isSelected = true)Sets whether the row is selected - what marks the page it opens as the one being shown.
Parameters
- isSelected
- Whether the row is selected.
Returns
The current instance of the type.
public T NotSortable()Marks the item as not sortable, which is what a row of chrome wants.
Returns
The current instance of the type.
public T Class(string className)Adds a class to both renderings of the item.
Parameters
- className
- The class name.
Returns
The current instance of the type.
| Overload | |
|---|---|
| Tooltip(string) | Sets the tooltip shown on the collapsed rail, where the row is the picture alone. None - the default - shows the name and the second line. |
| Tooltip(IComponent) | Sets the tooltip component shown on the collapsed rail. |
| Overload | |
|---|---|
| OnClick(Action) | Adds a click event handler to the row itself. The commands are separate buttons, so pressing one is not pressing the row. |
| OnClick(Action<Button, MouseEvent>) | Adds a click event handler with button and mouse event arguments. |
public T OnContextMenu(Action<Button, MouseEvent> action)Adds a context menu event handler.
Parameters
- action
- The event handler action.
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 item for the closed state of the sidebar.
public IComponent RenderOpen()Renders the item for the open state of the sidebar.
protected void SetTitleText(string title)Replaces the name on the first line. Kept protected so each row can name it for what it holds - the account's name, the product's name - and keep whatever else follows from it in step.
Parameters
- title
- The name.
protected void SetTitleBadge(HTMLElement badge, string text)Puts an element on the name's line, after the name - a label that qualifies the name itself rather than adding a second line under it, like the environment a brand's application runs in. The name gives way before it does: a name too long for the row is ellipsized and the label stays whole. The name and the label share a line of their own only while there is a label, so a row without one keeps exactly the markup it always had.
Parameters
- badge
- The element to put after the name, or null to remove the one there.
- text
- What the label says, for the collapsed rail's tooltip, which has no room for the element.
protected void FitRailToText()Has the open rail the row sits on grow to the width its name and second line need, so neither is ellipsized - for the row whose text is what the rail is for, the application's name. The rail never shrinks below the width it was given; this only raises its floor. The row measures itself rather than asking for a number, because what the text has to share the row with - the rail's padding, the logo, the gap, the strip of commands - is the stylesheet's and a skin's to change. The room the text has now is subtracted from the rail's width, and what the text wants is added back: whatever else is on the row cancels out, and so does the rail's own width. So the answer only moves with what is on the row, and that is when it is measured: each time the open row is mounted, when the text or the commands change, and once the fonts arrive. Never on a resize - a rail being dragged wider would otherwise force a layout read and restyle the whole sidebar on every frame, to write the number it already had.
private double TitleLineWidth()The width the name's line wants: the name, and with a label after it the distance from the end of the name as drawn to the end of the label - the gap and the label, whatever a skin makes them, and the same whether or not the name is ellipsized at the moment, since the label follows it.
private void OnOpenRowRemoved()The open row comes off the rail every time the rail closes, and the collapsed picture goes on in the same pass. The floor stays then - the stylesheet ignores it on a closed rail, and the rail opens straight to it - and goes only when the row has left the rail altogether.
private HTMLElement RailToFit()The sidebar the row is on, unless that is a child sidebar shifted into another (ShiftTo): a child fills its host's panel and the host owns the width, so a child's row is left to ellipsize rather than widen a rail that is not its own.
protected void SetPrimaryCommand(SidebarCommand command)The row's own command, drawn last - settings on a profile, configuration on a brand.
Parameters
- command
- The command, or null to remove it.
protected void SetSecondaryCommand(SidebarCommand command)The row's second command, drawn after the first - logging out, on a profile.
Parameters
- command
- The command, or null to remove it.
Fields
| Name | Description |
|---|---|
| RAIL_MIN_WIDTH_VARIABLE | The width the open rail needs for the row's text to be drawn whole, written on the rail by FitRailToText and turned into a min-width by tss.sidebar.css only while the rail is open - a variable rather than the property itself, so the closed rail's 54px and the page and navbar layouts are the stylesheet's to keep. |
| RAIL_FITS_CLASS | The class that tells the stylesheet the rail carries RAIL_MIN_WIDTH_VARIABLE. |
private const string RAIL_MIN_WIDTH_VARIABLE = "--tss-sidebar-identity-min-width"The width the open rail needs for the row's text to be drawn whole, written on the rail by FitRailToText and turned into a min-width by tss.sidebar.css only while the rail is open - a variable rather than the property itself, so the closed rail's 54px and the page and navbar layouts are the stylesheet's to keep.
SidebarSectionHeader
A heading at the top of a sidebar that names the section it shows: a glyph, a name and an optional description line. It does not respond to the pointer, takes no tab stop and has no commands. Use it where a Sidenav to the left picks the section.
public class SidebarSectionHeader : ISidebarItemThe row at the top of a sidebar that names the section the sidebar is showing: the section's glyph, its name and an optional line saying what is in it ("Data, AI and delivery"). It has the shape and height of SidebarBrand but is a heading rather than a control: it does not answer the pointer, takes no tab stop and carries no commands. Use it where a rail to the left (a Sidenav) picks the section and the sidebar beside it lists what is in it. On the collapsed rail the header is the glyph alone, with the name (and the second line) in its tooltip.
- Namespace
- Tesserae
- Implements
- ISidebarItem
Constructors
| Name | Description |
|---|---|
| SidebarSectionHeader | Initializes a new instance of the SidebarSectionHeader class. |
public SidebarSectionHeader(string identifier, UIcons icon, string title, string subtitle = null, UIconsWeight weight = UIconsWeight.Regular)Initializes a new instance of the SidebarSectionHeader class.
Parameters
- identifier
- The identifier for the item.
- icon
- The section's glyph.
- title
- The section's name.
- subtitle
- What is in the section. None leaves the header a single line.
- weight
- The glyph's weight.
Properties
| Name | Description |
|---|---|
| IsSelected | Gets or sets whether the item is currently selected. A heading is not a destination, so this is only carried for the sidebar's sake. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the item, including group identifiers. |
| OwnIdentifier | Gets the own identifier of the item, without group identifiers. |
public bool IsSelected { get; set; }Gets or sets whether the item is currently selected. A heading is not a destination, so this is only carried for the sidebar's sake.
public IComponent CurrentRenderedGets the component that is currently rendered.
public string Identifier { get; private set; }Gets the full identifier of the item, including group identifiers.
Methods
| Name | Description |
|---|---|
| AddGroupIdentifier | Adds a group identifier prefix to the item's identifier. |
| Show | Shows the item. |
| Collapse | Collapses the item. |
| SetTitle | Sets the section's name. |
| SetSubtitle | Sets the second line. Null or empty leaves the header a single line. |
| Separated | Draws a divider under the header, run out to the sidebar's own edges, between it and the rows it heads. |
| NotSortable | Marks the item as not draggable in a sortable sidebar. |
| RenderClosed | Renders the item for the closed state of the sidebar. |
| RenderOpen | Renders the item for the open state of the sidebar. |
public void AddGroupIdentifier(string groupIdentifier)Adds a group identifier prefix to the item's identifier.
public SidebarSectionHeader SetTitle(string title)Sets the section's name.
Parameters
- title
- The name.
Returns
The current instance of the type.
public SidebarSectionHeader SetSubtitle(string subtitle)Sets the second line. Null or empty leaves the header a single line.
Parameters
- subtitle
- What is in the section.
Returns
The current instance of the type.
public SidebarSectionHeader Separated(bool separated = true)Draws a divider under the header, run out to the sidebar's own edges, between it and the rows it heads.
Parameters
- separated
- Whether to draw it.
Returns
The current instance of the type.
public SidebarSectionHeader NotSortable()Marks the item as not draggable in a sortable sidebar.
Returns
The current instance of the type.
public IComponent RenderClosed()Renders the item for the closed state of the sidebar.
SidebarStatusCard
A card at the top of a sidebar showing what its section is doing: a glyph and name, a status line with a coloured dot, and an optional progress bar with a caption for a running job. Every part can be updated after it is on screen.
public class SidebarStatusCard : ISidebarItemA card at the top of a sidebar that says what the section it heads is doing right now: a glyph and the section's name, a status line ("Index healthy · 2.4M nodes") with a dot in the status's tone, and optionally a progress bar with a caption under it for a job that is running ("Re-index 72% · 4 min left"). Every part can be changed after it is on screen, so it is meant to be kept up to date from whatever reports the state. On the collapsed rail the card is the glyph alone, with the progress drawn as a short bar under it and the whole text in its tooltip.
- Namespace
- Tesserae
- Implements
- ISidebarItem
Constructors
| Name | Description |
|---|---|
| SidebarStatusCard | Initializes a new instance of the SidebarStatusCard class. |
public SidebarStatusCard(string identifier, UIcons icon, string title, string status = null, UIconsWeight weight = UIconsWeight.Regular)Initializes a new instance of the SidebarStatusCard class.
Parameters
- identifier
- The identifier for the item.
- icon
- The section's glyph.
- title
- The section's name.
- status
- The status line. None leaves the card without one.
- weight
- The glyph's weight.
Properties
| Name | Description |
|---|---|
| IsSelected | Gets or sets whether the item is currently selected. A status card is not a destination, so this is only carried for the sidebar's sake. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the item, including group identifiers. |
| OwnIdentifier | Gets the own identifier of the item, without group identifiers. |
public bool IsSelected { get; set; }Gets or sets whether the item is currently selected. A status card is not a destination, so this is only carried for the sidebar's sake.
public IComponent CurrentRenderedGets the component that is currently rendered.
public string Identifier { get; private set; }Gets the full identifier of the item, including group identifiers.
Methods
| Name | Description |
|---|---|
| AddGroupIdentifier | Adds a group identifier prefix to the item's identifier. |
| Show | Shows the item. |
| Collapse | Collapses the item. |
| SetTitle | Sets the section's name. |
| SetStatus | Sets the status line. Null or empty hides it. |
| Success | Draws the status dot in the success colour. |
| Warning | Draws the status dot in the warning colour. |
| Danger | Draws the status dot in the danger colour. |
| Neutral | Draws the status dot in the neutral colour, which is the default. |
| Progress | Shows a progress bar for a running job, with an optional caption under it. |
| Indeterminate | Shows an indeterminate progress bar, for a job that cannot say how far along it is. |
| ClearProgress | Removes the progress bar and its caption. |
| OnClick | Runs an action when the card is clicked, typically to open the page with the full status. |
| NotSortable | Marks the item as not draggable in a sortable sidebar. |
| RenderClosed | Renders the item for the closed state of the sidebar. |
| RenderOpen | Renders the item for the open state of the sidebar. |
public void AddGroupIdentifier(string groupIdentifier)Adds a group identifier prefix to the item's identifier.
public SidebarStatusCard SetTitle(string title)Sets the section's name.
Parameters
- title
- The name.
Returns
The current instance of the type.
public SidebarStatusCard SetStatus(string status)Sets the status line. Null or empty hides it.
Parameters
- status
- The status, e.g. "Index healthy · 2.4M nodes".
Returns
The current instance of the type.
public SidebarStatusCard Success()Draws the status dot in the success colour.
Returns
The current instance of the type.
public SidebarStatusCard Warning()Draws the status dot in the warning colour.
Returns
The current instance of the type.
public SidebarStatusCard Danger()Draws the status dot in the danger colour.
Returns
The current instance of the type.
public SidebarStatusCard Neutral()Draws the status dot in the neutral colour, which is the default.
Returns
The current instance of the type.
public SidebarStatusCard Progress(float percent, string caption = null)Shows a progress bar for a running job, with an optional caption under it.
Parameters
- percent
- How far along the job is, from 0 to 100.
- caption
- The caption, e.g. "Re-index 72% · 4 min left". None leaves the bar on its own.
Returns
The current instance of the type.
public SidebarStatusCard Indeterminate(string caption = null)Shows an indeterminate progress bar, for a job that cannot say how far along it is.
Parameters
- caption
- The caption. None leaves the bar on its own.
Returns
The current instance of the type.
public SidebarStatusCard ClearProgress()Removes the progress bar and its caption.
Returns
The current instance of the type.
public SidebarStatusCard OnClick(Action onClick)Runs an action when the card is clicked, typically to open the page with the full status.
Parameters
- onClick
- What clicking the card does.
Returns
The current instance of the type.
public SidebarStatusCard NotSortable()Marks the item as not draggable in a sortable sidebar.
Returns
The current instance of the type.
public IComponent RenderClosed()Renders the item for the closed state of the sidebar.
SidebarSeparator
A divider between groups of sidebar items, optionally with a label.
public class SidebarSeparator : ISidebarItem- Namespace
- Tesserae
- Implements
- ISidebarItem
SidebarPageBar
The bar at the top of the content while a sidebar renders as a page (Sidebar.AsPage): a back button that brings the sidebar back, the brand, the page title and room for commands.
public sealed class SidebarPageBar : IComponentThe bar at the top of the content while a Sidebar renders as a page (AsPage): a back button that brings the sidebar back, the app's brand and the title of the page on screen, with room for commands on the right.
Remarks
It is part of the content rather than of the sidebar, since the sidebar is hidden while the content is on screen, and it draws itself only while its sidebar is a page - so it can stay mounted on every layout and cost a desktop nothing.
- Namespace
- Tesserae
- Implements
- IComponent
Constructors
| Name | Description |
|---|---|
| SidebarPageBar | Initializes a new instance of the SidebarPageBar class. |
Properties
| Name | Description |
|---|---|
| Title | Gets or sets the title of the page on screen. |
Methods
| Name | Description |
|---|---|
| Brand | Sets the brand shown between the back button and the title - typically the app's logo. |
| SetTitle | Sets the title of the page on screen. |
| Commands | Replaces the commands on the right of the bar. |
| Render | Renders the bar. |
public SidebarPageBar Brand(IComponent brand)Sets the brand shown between the back button and the title - typically the app's logo.
Parameters
- brand
- The brand, or null for none.
Returns
The current instance.
public SidebarPageBar SetTitle(string title)Sets the title of the page on screen.
Parameters
- title
- The title.
Returns
The current instance.
public SidebarPageBar Commands(params IComponent[] commands)Replaces the commands on the right of the bar.
Parameters
- commands
- The commands.
Returns
The current instance.
SidebarComponent
A sidebar item that is simply a component of the host's own (a list, a picker, a whole panel), for the parts of a sidebar that buttons and separators can't express. A chat history, a tree of spaces, a filter form: whatever it is, it keeps its own state and only asks the sidebar for a place to stand. The closed (icon-rail) state gets a component of its own; passing none leaves the item out of the rail entirely, which is usually what a list wants.
public class SidebarComponent : ISidebarItemA sidebar item that is simply a component of the host's own - a list, a picker, a whole panel - for the parts of a sidebar that buttons and separators can't express. A chat history, a tree of spaces, a filter form: whatever it is, it keeps its own state and only asks the sidebar for a place to stand. The closed (icon-rail) state gets a component of its own, since almost nothing that is worth putting here fits in a 48px rail. Passing none - the default - leaves the item out of the rail entirely, which is usually what a list wants.
- Namespace
- Tesserae
- Implements
- ISidebarItem
Constructors
| Name | Description |
|---|---|
| SidebarComponent | Initializes a new instance of the SidebarComponent class. |
public SidebarComponent(string identifier, IComponent component, IComponent closedComponent = null)Initializes a new instance of the SidebarComponent class.
Parameters
- identifier
- The identifier for the item.
- component
- What the item shows while the sidebar is open.
- closedComponent
- What it shows while the sidebar is collapsed to its rail. Null - the default - shows nothing at all there.
Properties
| Name | Description |
|---|---|
| IsSelected | Gets or sets whether the item is currently selected. A hosted component owns its own selection, so this is only carried for the sidebar's sake. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the item, including group identifiers. |
| OwnIdentifier | Gets the own identifier of the item, without group identifiers. |
public bool IsSelected { get; set; }Gets or sets whether the item is currently selected. A hosted component owns its own selection, so this is only carried for the sidebar's sake.
public IComponent CurrentRenderedGets the component that is currently rendered.
public string Identifier { get; private set; }Gets the full identifier of the item, including group identifiers.
Methods
| Name | Description |
|---|---|
| AddGroupIdentifier | Adds a group identifier prefix to the item's identifier. |
| Show | Shows the item. |
| Collapse | Collapses the item. |
| NotSortable | Marks the item as not draggable in a sortable sidebar - which is what a hosted component usually wants, since it is a region rather than an entry in a list. |
| Grow | Lets the item take the leftover height of the sidebar's middle section, for a component that scrolls its own content (a list of chats, a tree). |
| RenderClosed | Renders the item for the closed state of the sidebar. |
| RenderOpen | Renders the item for the open state of the sidebar. |
public void AddGroupIdentifier(string groupIdentifier)Adds a group identifier prefix to the item's identifier.
public SidebarComponent NotSortable()Marks the item as not draggable in a sortable sidebar - which is what a hosted component usually wants, since it is a region rather than an entry in a list.
public SidebarComponent Grow()Lets the item take the leftover height of the sidebar's middle section, for a component that scrolls its own content (a list of chats, a tree).
public IComponent RenderClosed()Renders the item for the closed state of the sidebar.
public interface ISidebarItemDefines the interface for items that can be displayed within a Sidebar.
- Namespace
- Tesserae
Properties
| Name | Description |
|---|---|
| IsSelected | Gets or sets whether the item is currently selected. |
| CurrentRendered | Gets the component that is currently rendered. |
| Identifier | Gets the full identifier of the item, including group identifiers. |
| OwnIdentifier | Gets the own identifier of the item, without group identifiers. |
bool IsSelected { get; set; }Gets or sets whether the item is currently selected.
IComponent CurrentRendered { get; }Gets the component that is currently rendered.
string Identifier { get; }Gets the full identifier of the item, including group identifiers.
Methods
| Name | Description |
|---|---|
| RenderClosed | Renders the item for the closed (collapsed) state of the sidebar. |
| RenderOpen | Renders the item for the open (expanded) state of the sidebar. |
| Show | Shows the item. |
| Collapse | Collapses the item. |
| AddGroupIdentifier | Adds a group identifier prefix to the item's identifier. |
IComponent RenderClosed()Renders the item for the closed (collapsed) state of the sidebar.
IComponent RenderOpen()Renders the item for the open (expanded) state of the sidebar.