suiss/ui · Component
Marker
An inline annotation for timelines and conversations, such as a date divider or system event.
Marker is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Marker displays a short line of secondary text, typically between messages or list entries. Put the text in MarkerContent and, optionally, a leading MarkerIcon.
Use Marker for annotations within content; use Separator for a purely visual rule with no text.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
- Install the following dependencies and add the
cnhelper:
- Copy and paste the following code into your project.
- Update the import paths to match your project setup.
Usage
Composition
Use the following composition to build a Marker:
Examples
Variants
Use the variant prop to pick the treatment: default for plain text, separator for text between two rules, or border for text above a bottom border.
Separator
Set variant="separator" to center the text between two horizontal rules, as used for a date divider.
With icon
Put a decorative icon in MarkerIcon before the content, shown here in the default and separator variants.
With link
A marker whose content includes an inline link. Links inside the marker or its content are underlined automatically and hover to foreground.
Accessibility
MarkerIconsetsaria-hidden="true", so icons must be decorative; put meaningful text inMarkerContent.- Links inside the content remain in the normal tab order.
API Reference
Marker
The container row that applies the variant styling.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "separator" | "border" | "default" |
Also accepts the props of useRender.ComponentProps<"div">.
Use the render prop to change the underlying element.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
Also accepts the props of React.ComponentProps<"div">.
Set asChild and pass the element as the child to change the underlying element.
| Prop | Type | Default |
|---|---|---|
render | (props) => React.ReactNode | - |
Also accepts the props of React.ComponentProps<"div">.
Pass a render function that returns the element with the props it receives to change the underlying element.
Rules and borders use the border color and text uses muted-foreground.
MarkerIcon
A decorative icon slot shown before the content and hidden from assistive technology.
Also accepts the props of React.ComponentProps<"span">.
MarkerContent
Holds the marker text and any inline links.
Also accepts the props of React.ComponentProps<"span">.
Each part sets a data-slot, such as marker or marker-content, for styling. The root also exposes data-variant.
Web preview
Marker is a row of secondary text with an optional icon. It has three variants: default for a plain row, separator for centered text with a line on each side, and border for a row with a bottom border.
Use separator for date dividers in a chat or feed, border for section headings, and default for short notices.
Installation
- Install the following dependencies:
- Copy and paste the following code into
components/ui/marker.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
- Copy and paste the following code into
components/ui/marker.tsx:
- Update the import paths to match your project setup.
- Copy and paste the following code into
components/ui/marker.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Accessibility
MarkerIconand the separator lines are hidden from screen readers, so only the text is read.- If the icon carries meaning, include it in the text.
API Reference
Marker
Row that sets the variant and the text and icon styles.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "separator" | "border" | "default" |
render | RenderProp<Record<string, unknown>, Record<string, never>> | - |
Also accepts the props of ViewProps.
Pass a render element to render the marker as another component instead of a View. Text and icons inside the marker pick up the text-sm text-muted-foreground style and the size-4 icon size through context. Lines and the bottom border use bg-border and border-border.
MarkerIcon
Fixed-size slot for an icon.
Also accepts the props of ViewProps.
Put an Icon inside it.
MarkerContent
Marker text, centered in the separator variant.
Also accepts the props of React.ComponentProps<typeof Text>.
MarkerVariant
Values: .default, .separator, .border.
Marker
Row that sets the variant and the text and icon styles.
| Parameter | Type | Default |
|---|---|---|
_ variant | MarkerVariant: .default | .separator | .border | .default |
content | () -> Content | - |
_ title | LocalizedStringKey | - |
icon | Image? | nil |
variant | MarkerVariant: .default | .separator | .border | .default |
verbatim | String | - |
Overloads: init(_:content:), init(_:icon:variant:), init(verbatim:icon:variant:).
MarkerIcon
Fixed-size slot for an icon.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
MarkerContent
Marker text, centered in the separator variant.
| Parameter | Type | Default |
|---|---|---|
content | () -> Content | - |
_ text | LocalizedStringKey | - |
verbatim | String | - |
Overloads: init(content:), init(_:), init(verbatim:).
MarkerVariant
Values: Default, Separator, Border.
Marker
Row that sets the variant and the text and icon styles.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
variant | MarkerVariant: Default | Separator | Border | MarkerVariant.Default |
content | @Composable RowScope.() -> Unit | - |
text | String | - |
icon | ImageVector? | null |
Overloads: Marker(content), Marker(text, icon).
MarkerIcon
Fixed-size slot for an icon.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable BoxScope.() -> Unit | - |
MarkerContent
Marker text, centered in the separator variant.
Receiver: RowScope.
| Parameter | Type | Default |
|---|---|---|
modifier | Modifier | Modifier |
content | @Composable () -> Unit | - |
text | String | - |
Overloads: MarkerContent(content), MarkerContent(text).