The trash icon: a 24 by 24 stroke glyph that takes its colour from the text around it.
registry/behivetech/icons/trash · depends on @behivetech/icons.base
trash.tsx
1import { createIcon } from "@behivetech/icons.base";23/** The trash icon: a stroke glyph on a 24 by 24 grid that inherits the text colour. */4export const TrashIcon = /*#__PURE__*/ createIcon(5 "TrashIcon",6 <>7 <path d="M3 6h18" />8 <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />9 <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" />10 <path d="M10 11v6" />11 <path d="M14 11v6" />12 </>,13);1415export default TrashIcon;
index.ts
1export { TrashIcon, default } from "./trash.js";
trash.example.tsx
1import { TrashIcon } from "./trash.js";23/** The icon at each size; it takes its colour from the surrounding text. */4export const TrashIconSizes = () => (5 <>6 <TrashIcon size="sm" />7 <TrashIcon />8 <TrashIcon size="lg" />9 <TrashIcon size="xl" />10 </>11);1213/** Named with `titleAccess`, so assistive technology announces it. */14export const NamedTrashIcon = () => <TrashIcon titleAccess="Trash" />;
trash.spec.tsx
1import { render } from "@testing-library/react";2import TrashIconDefault, { TrashIcon } from "./trash.js";34describe("TrashIcon", () => {5 it("exports the same component by name and by default", () => {6 expect(TrashIconDefault).toBe(TrashIcon);7 expect(TrashIcon.displayName).toBe("TrashIcon");8 });910 it("draws its glyph and hides from assistive technology", () => {11 const { container } = render(<TrashIcon />);12 const svg = container.querySelector("svg");1314 expect(15 svg?.querySelector(16 "path, circle, rect, ellipse, line, polyline, polygon",17 ),18 ).not.toBeNull();19 expect(svg?.getAttribute("aria-hidden")).toBe("true");20 });2122 it("is an image named by titleAccess", () => {23 const { container } = render(<TrashIcon titleAccess="Trash" />);24 const svg = container.querySelector("svg");2526 expect(svg?.getAttribute("role")).toBe("img");27 expect(svg?.querySelector("title")?.textContent).toBe("Trash");28 });29});