components/ShowMore
import { … } from 'zidane-ui'ui/src/components/ShowMore.tsx
Components#
ShowMoreButtonComponent#
The Show more button under a capped list, on the rows' left edge. Every capped list in the kit uses it, with
useShowMore.
function ShowMoreButton(props: ShowMoreButtonProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | ShowMoreButtonProps | Component props. |
Returns
Element | nullProps
| Name | Type | Description |
|---|---|---|
| className? | string | Extra classes on the root. Default: on a list's rows' edge. |
| expanded? | boolean | The list was expanded: with |
| hidden | number | How many items are hidden. Nothing renders at 0, unless the list is expanded and can show fewer. |
| onFewer? | () => void | Caps the list again. Without it, an expanded list shows no button. |
| onMore | () => void | Shows them. |
| style? | CSSProperties | Inline styles on the root element. |
Functions#
useShowMoreFunction#
Caps a list at cap items until Show more is pressed.
function useShowMore<T>(list: readonly T[], cap?: number): ShowMore<T>Type parameters
| Name | Description |
|---|---|
| T |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| list | readonly T[] | The whole list. | |
| cap? | number | SHOW_MORE_CAP | How many show at first. Default: |
Returns
ShowMore<T>Constants#
SHOW_MORE_CAPConstant#
How many rows a list shows before Show more, unless it says otherwise.
const SHOW_MORE_CAP = 8Interfaces#
ShowMoreInterface#
What useShowMore returns.
interface ShowMore<T>Type parameters
| Name | Description |
|---|---|
| T |
Properties
| Name | Type | Description |
|---|---|---|
| expanded | boolean | Whether Show more was pressed. |
| fewer | () => void | Caps the list again. |
| hidden | number | How many are hidden. |
| more | () => void | Shows them all. |
| shown | readonly T[] | The items shown. |
ShowMoreButtonPropsInterface#
Props for ShowMoreButton.
interface ShowMoreButtonPropsProperties
| Name | Type | Description |
|---|---|---|
| className? | string | Extra classes on the root. Default: on a list's rows' edge. |
| expanded? | boolean | The list was expanded: with |
| hidden | number | How many items are hidden. Nothing renders at 0, unless the list is expanded and can show fewer. |
| onFewer? | () => void | Caps the list again. Without it, an expanded list shows no button. |
| onMore | () => void | Shows them. |
| style? | CSSProperties | Inline styles on the root element. |