A pressable tile
import { Text } from "@senvenli/react/display";
import { Grid, Stack } from "@senvenli/react/layout";
import { Pressable } from "@senvenli/react/action";
import { useState } from "react";
const PLANS = [
{ id: "starter", name: "Starter", detail: "3 projects, 1 seat" },
{ id: "team", name: "Team", detail: "Unlimited projects, 10 seats" },
];
export default function Example() {
const [plan, setPlan] = useState("starter");
return (
<Grid minColumnWidth={200} space="space-150">
{PLANS.map((item) => (
<Pressable
key={item.id}
padding="space-200"
radius="large"
border
background={plan === item.id ? "selected" : "surface"}
aria-pressed={plan === item.id}
onPress={() => setPlan(item.id)}
>
<Stack as="span" space="space-050">
<Text weight="medium">{item.name}</Text>
<Text size="body-small" tone="subtle">{item.detail}</Text>
</Stack>
</Pressable>
))}
</Grid>
);
}import { Pressable } from "@senvenli/react/action";Examples
A row that is a link
With `href` the whole row navigates.import { Avatar, Icon, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
import { Pressable } from "@senvenli/react/action";
export default function Example() {
return (
<Pressable href="#customer" padding="space-150" radius="large" background="surface-sunken">
<Stack direction="horizontal" as="span" space="space-150" justify="between" wrap={false}>
<Stack direction="horizontal" as="span" space="space-150" wrap={false}>
<Avatar name="Sofia Marin" src="/avatars/05.webp" />
<Stack as="span">
<Text weight="medium">Sofia Marin</Text>
<Text size="body-small" tone="subtle">14 orders</Text>
</Stack>
</Stack>
<Icon name="chevron-right" color="subtle" />
</Stack>
</Pressable>
);
}Disabled
Dimmed, and it takes no press or focus.import { Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
import { Pressable } from "@senvenli/react/action";
export default function Example() {
return (
<Pressable padding="space-200" radius="large" border isDisabled>
<Stack as="span" space="space-050">
<Text weight="medium">Enterprise</Text>
<Text size="body-small" tone="subtle">Not available in your region yet.</Text>
</Stack>
</Pressable>
);
}Guidelines
When to use it
- A custom-designed tile or row must be pressable.
Use something else when
- A standard interactive card fits. Card
Accessibility
Keyboard
| Keys | What happens |
|---|---|
| Enter, Space | Presses it (Enter only for links). |
Built in
- Real button or link semantics with the inner focus border.
You provide
- An accessible name from its text or
aria-label.
API reference
Pressable
| Prop | Type | Default | Description |
|---|---|---|---|
padding | Space | – | |
paddingInline | Space | – | |
paddingBlock | Space | – | |
background | Background | – | |
radius | Radius | – | |
shadow | Shadow | – | |
border | Border | – | |
fullWidth | boolean | true | As wide as its container (default |
children | React.ReactNode | – | |
isDisabled | boolean | – | |
aria-label | string | – | Required when the content has no text that names the action. |
id | string | – | |
onPress | (event: PressEvent) => void | – | |
href | string | – |
paddingSpacepaddingInlineSpacepaddingBlockSpacebackgroundBackgroundradiusRadiusshadowShadowborderBorderfullWidthbooleanDefaulttrueAs wide as its container (default
true), as a button or a link;falsehugs what it holds.childrenReact.ReactNodeisDisabledbooleanaria-labelstringRequired when the content has no text that names the action.
idstringonPress(event: PressEvent) => voidhrefstring
Also takes 3 standard DOM and ARIA attributes (id, aria-label, event handlers…).