SandboxedOnClick
A container that prevents the click event from bubbling out of it.
Each table row will trigger a window.alert()
when clicked. The icon button is wrapped in SandboxedOnClick
and navigates you to the ngrok docs.
import { IconButton } from "@ngrok/mantle/button";
import { SandboxedOnClick } from "@ngrok/mantle/sandboxed-on-click";
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFoot,
TableHead,
TableHeader,
TableRoot,
TableRow,
} from "@ngrok/mantle/table";
import { Book } from "@phosphor-icons/react/Book";
<TableRoot>
<Table>
<TableCaption>A list of your recent invoices.</TableCaption>
<TableHead>
<TableRow>
<TableHeader className="w-[100px]">Invoice</TableHeader>
<TableHeader>Status</TableHeader>
<TableHeader>Method</TableHeader>
<TableHeader className="text-right">Amount</TableHeader>
<TableHeader className="text-right">Actions</TableHeader>
</TableRow>
</TableHead>
<TableBody>
{invoices.map((invoice) => (
<TableRow
key={invoice.invoice}
className="cursor-pointer"
onClick={() => {
window.alert(`Clicked on ${invoice.invoice}!`);
}}
>
<TableCell className="font-medium">
{invoice.invoice}
</TableCell>
<TableCell>{invoice.paymentStatus}</TableCell>
<TableCell>{invoice.paymentMethod}</TableCell>
<TableCell className="text-right">
{invoice.totalAmount}
</TableCell>
<TableCell className="text-right">
<SandboxedOnClick allowClickEventDefault>
<IconButton
label="See ngrok docs"
icon={<Book />}
asChild
>
<a href="https://ngrok.com/docs" target="_blank" />
</IconButton>
</SandboxedOnClick>
</TableCell>
</TableRow>
))}
</TableBody>
<TableFoot>
<TableRow>
<TableCell colSpan={3}>Total</TableCell>
<TableCell className="text-right">$2,500.00</TableCell>
<TableCell />
</TableRow>
</TableFoot>
</Table>
</TableRoot>
API Reference
SandboxedOnClick
A container that prevents the click event from bubbling out of it. Good to use when you want to provide some action buttons inside of a table row or list item that navigates on click.
Good to use when you want to provide some action buttons inside of a table row or list item that navigates on click.
All props from div, plus: