Inline Pagination
Description
The compact "‹ 3 of 7 ›" control
InlinePagination is a chevron either side of where you are in a set, inside one rounded pill. Use it for stepping through things one at a time (the result open in a preview, the photo in a lightbox, the record in an editor) beside other commands in a toolbar or a header, where Pagination's row of numbered page buttons would be too much.
Each chevron is enabled by having a handler: OnPrevious and OnNext. Leaving one out greys its chevron, which is how the first and the last of a set say so. The position and count only write the label, so a set that loads more as it goes stays in charge of when there is a next.
SetLabel replaces the counted label with text of your own ("Page 3", "March", the name of the thing you are on), and SetFormat changes how the position and count are written, for another language or for "3 / 7". SetTooltips names each chevron for a screen reader.
Samples
Stepping through a set
A custom label and format
API reference
public sealed class InlinePagination : ComponentBase<InlinePagination, HTMLElement>The compact "‹ 3 of 7 ›" control: a chevron either side of where you are in a set, inside one rounded pill. It is for stepping through things one at a time - the result open in a preview, the photo in a lightbox, the record in an editor - beside other commands in a toolbar or a header, where Pagination's row of numbered page buttons would be far too much. Each chevron is enabled by having a handler: OnPrevious and OnNext. Leaving one out greys its chevron, which is how the first and the last of a set say so - the position and count only write the label, so a set that loads more as it goes stays in charge of when there is a next.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<InlinePagination, HTMLElement> → InlinePagination
Constructors
| Name | Description |
|---|---|
| InlinePagination | Initializes a new instance of this class showing the given position in the given count, both 1-based. A count of zero leaves the label out and the control is the two chevrons alone. |
Properties
| Name | Description |
|---|---|
| Position | Gets or sets where in the set the control says you are, 1-based. |
| Count | Gets or sets how many there are in the set. Zero leaves the label out. |
| CanGoPrevious | Returns a value indicating whether the previous chevron is enabled. |
| CanGoNext | Returns a value indicating whether the next chevron is enabled. |
public int Position { get ; set ; }Gets or sets where in the set the control says you are, 1-based.
public int Count { get ; set ; }Gets or sets how many there are in the set. Zero leaves the label out.
public bool CanGoPreviousReturns a value indicating whether the previous chevron is enabled.
Methods
| Name | Description |
|---|---|
| Render | Renders the component's root HTML element. |
| SetPosition | Sets where in the set the control says you are, and how many there are - both 1-based. A count of zero (or a position past it) leaves the label out, so a set whose size isn't known yet shows the chevrons alone rather than a label that would have to lie. |
| SetLabel | Puts the given text between the chevrons in place of the position and count - "Page 3", "March", the name of the thing you are on. Pass null to go back to the counted label. |
| SetFormat | Changes how the position and the count are written - for another language, or for "3 / 7". |
| OnPrevious | Registers what the previous chevron does, and enables it. Pass null to grey it out - which is how the first of a set says it is the first. |
| OnNext | Registers what the next chevron does, and enables it. Pass null to grey it out. |
| SetTooltips | Sets what each chevron is called for a screen reader and in its tooltip - "Previous result" and "Next result" rather than the bare "Previous" and "Next" they carry by default. |
public override HTMLElement Render()Renders the component's root HTML element.
public InlinePagination SetPosition(int position, int count)Sets where in the set the control says you are, and how many there are - both 1-based. A count of zero (or a position past it) leaves the label out, so a set whose size isn't known yet shows the chevrons alone rather than a label that would have to lie.
public InlinePagination SetLabel(string text)Puts the given text between the chevrons in place of the position and count - "Page 3", "March", the name of the thing you are on. Pass null to go back to the counted label.
public InlinePagination SetFormat(Func<int, int, string> format)Changes how the position and the count are written - for another language, or for "3 / 7".
public InlinePagination OnPrevious(Action<InlinePagination> onPrevious)Registers what the previous chevron does, and enables it. Pass null to grey it out - which is how the first of a set says it is the first.
public InlinePagination OnNext(Action<InlinePagination> onNext)Registers what the next chevron does, and enables it. Pass null to grey it out.
See also
- Pagination — numbered page buttons, for a list you page through.
- Omni Result — the preview whose header this steps through.
- Components overview