# @rendr-view/btn

> A base button component that works as either a HTML button or a link depending on the given props.

Latest version **1.0.2** (published 2026-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rendr-view/btn
pnpm add @rendr-view/btn
yarn add @rendr-view/btn
bun add @rendr-view/btn
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2026-02-12 |
| First published | 2022-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.11.0 |
| Dependencies | 3 |
| Unpacked size | 128.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | fiveid |

## Links

- npm: https://www.npmjs.com/package/@rendr-view/btn
- Repository: https://github.com/fiveid/rendr-view
- Homepage: https://github.com/fiveid/rendr-view#readme
- Issues: https://github.com/fiveid/rendr-view/issues
- npm.io page: https://npm.io/package/@rendr-view/btn

## Dependencies (3)

- [clsx](https://npm.io/package/clsx.md) ^1.1.1
- [react-icons](https://npm.io/package/react-icons.md) ^4.3.1
- [@rendr-view/with-clxn](https://npm.io/package/@rendr-view/with-clxn.md) 1.0.2

## Recent versions

- 1.0.2 (latest) — 2026-02-12
- 1.0.1 — 2026-02-12
- 1.0.0 — 2026-02-12
- 0.0.1 — 2025-03-15
- 0.0.1-alpha.3 — 2022-09-26
- 0.0.1-alpha.2 — 2022-09-26
- 0.0.1-alpha.1 — 2022-07-15
- 0.0.1-alpha.0 — 2022-07-02

## README

# @rendr-view/btn

A base button component that works as either a HTML button or a link depending on the given props.

## 1. Metadata

- **Package Name:** `@rendr-view/btn`
- **Description:** A flexible, accessible button/link component with icon support.
- **Category:** UI Primitive

## 2. API Design

### Exports

- `Btn` (Default): The primary button component.

### Props

The custom `Btn` props extend the HTML button attributes and HTML anchor link attributes.

```ts
interface Props extends ButtonProps {
  clx?: ClxnObject<ClassNamesList>;
  icon?: React.ComponentType<IconBaseProps>;
  buttonComponent?: React.ComponentType<HTMLButtonType> | "button";
  linkComponent?: React.ComponentType<HTMLLinkType> | "a";
  iconProps?: IconBaseProps;
}
```

#### clx
A record of classNames to style Btn elements: `button`, `enabled`, `disabled`, `label`, `icon`.

## 3. Implementation Details

- **Dependencies:** `@rendr-view/with-clxn`, `clsx`
- **Side Effects:** `false`

## 4. Usage Example

```tsx
import { Btn } from "@rendr-view/btn";
import { AiOutlineArrowRight } from "react-icons/ai";

function App() {
  return (
    <Btn 
      href="/contact" 
      icon={AiOutlineArrowRight}
      clx={{ button: "p-4 bg-primary text-white" }}
    >
      Contact Us
    </Btn>
  );
}
```

---
_Source: https://npm.io/package/@rendr-view/btn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
