# @conectate/ct-button

> HTML Button made with Web Components and Lit

Latest version **4.5.6** (published 2025-12-01) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @conectate/ct-button
pnpm add @conectate/ct-button
yarn add @conectate/ct-button
bun add @conectate/ct-button
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.5.6 |
| Published | 2025-12-01 |
| First published | 2020-06-09 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 33.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Herberth Obregón |
| Maintainers | herberthobregon |
| Keywords | LitElement, React, Vue, Angular, Web Components, Polymer |

## Links

- npm: https://www.npmjs.com/package/@conectate/ct-button
- Repository: https://github.com/conectate/ct-elements
- Issues: https://github.com/conectate/ct-elements/issues
- npm.io page: https://npm.io/package/@conectate/ct-button

## Dependencies (3)

- [lit](https://npm.io/package/lit.md) ^3.2.1
- [tslib](https://npm.io/package/tslib.md) ^2.6.3
- [@conectate/ct-icon](https://npm.io/package/@conectate/ct-icon.md) ^4.5.6

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 4.5.6 (latest) — 2025-12-01
- 4.5.5 — 2025-12-01
- 4.5.0 — 2025-11-27
- 4.4.17 — 2025-08-01
- 4.4.12 — 2025-05-03
- 4.4.9 — 2025-04-29
- 4.4.8 — 2025-03-06
- 4.4.7 — 2025-03-06
- 4.4.6 — 2025-03-05
- 4.4.5 — 2025-03-04
- 4.3.4 — 2025-02-18
- 4.3.1 — 2025-02-16
- 4.3.0 — 2025-02-16
- 4.1.0 — 2024-07-29
- 4.0.0 — 2024-07-27
- … 38 more at https://npm.io/package/@conectate/ct-button/versions

## README

<h1 align="center">@conectate/ct-button</h1>

<p align="center">
	<a href="https://npmcharts.com/compare/@conectate/ct-button?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/@conectate/ct-button.svg" height="20"/></a>
	<a href="https://www.npmjs.com/package/@conectate/ct-button"><img alt="NPM Version" src="https://img.shields.io/npm/v/@conectate/ct-button.svg" height="20"/></a>
	<a href="https://github.com/conectate/ct-elements/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/conectate/ct-elements.svg" height="20"/></a>
</p>

A customizable button web component with various styles and configurations.

## Installation

Install via npm or pnpm:

```sh
pnpm i @conectate/ct-button
# or
npm i @conectate/ct-button
```

## Basic Usage

```html
<ct-button>Click me</ct-button>
<ct-button raised>Raised Button</ct-button>
<ct-button shadow>Shadow Button</ct-button>
<ct-button flat>Flat Button</ct-button>
<ct-button light>Light Button</ct-button>
<ct-button disabled>Disabled Button</ct-button>
```

## Usage with ES Modules

If you are using frameworks like Lit, React, or Vue, import the component:

```ts
import "@conectate/ct-button";
```

### Example with LitElement (TypeScript)

```ts
import { LitElement, customElement, html } from "lit";
import "@conectate/ct-button";

@customElement("my-element")
class MyElement extends LitElement {
	render() {
		return html`
			<ct-button raised @click=${this.handleClick}>Click Me</ct-button>
		`;
	}

	handleClick() {
		console.log("Button clicked!");
	}
}
```

## Variants

The button comes in several variants:

- **Default**: Standard button
- **Raised**: Primary colored button
- **Shadow**: Button with opaque black background
- **Flat**: Button with a primary color border
- **Light**: Button with a primary color border (alternative style)

## Components

This package includes:

- `ct-button`: Standard button component
- `ct-button-menu`: Button with dropdown menu functionality
- `ct-button-split`: Split button with primary action and dropdown

## Properties

| Property   | Attribute  | Type      | Default    | Description                         |
| ---------- | ---------- | --------- | ---------- | ----------------------------------- |
| `raised`   | `raised`   | `boolean` | `false`    | Raised Style (primary color)        |
| `shadow`   | `shadow`   | `boolean` | `false`    | Shown with opaque black background. |
| `flat`     | `flat`     | `boolean` | `false`    | Shown with a primary color border   |
| `light`    | `light`    | `boolean` | `false`    | Shown with a primary color border   |
| `disabled` | `disabled` | `boolean` | `false`    | If `true`, Disable clicks           |
| `type`     | `type`     | `string`  | `"button"` | Button type (button, submit, reset) |

## Slots

- **Default slot**: Main content of the button
- **prefix**: Content placed above the main content
- **suffix**: Content placed below the main content

## CSS Variables

You can customize the component using the following CSS variables:

```css
ct-button {
	--color-primary: #00aeff; /* Primary color */
	--dark-primary-color: #00aeff; /* Dark Primary color */
	--ct-button-box-shadow: 0 2px 16px 4px rgba(99, 188, 240, 0.45); /* Box-Shadow for hover */
	--ct-button-shadow-color: rgba(64, 117, 187, 0.1); /* Shadow color */
	--ct-button-radius: 26px; /* Button border radius */
	--ct-button-padding: 0.4em 1em; /* Button padding */
}
```

## Accessibility (a11y)

The component has proper focus states and keyboard navigation support. Use `aria-label` for improved accessibility when needed.

## Follow Me

[![Herberth_thumb](https://user-images.githubusercontent.com/6503845/74269077-8bc2e100-4cce-11ea-8a6f-1ba34b8b5cf2.jpg)](https://x.com/herberthobregon)

[https://x.com/herberthobregon](https://x.com/herberthobregon)

## Contributing

1. Fork the repo
2. Create a new branch: `git checkout -b feature-branch`
3. Commit your changes: `git commit -m 'Add new feature'`
4. Push to your branch: `git push origin feature-branch`
5. Open a pull request!

## License

See [LICENSE](/LICENSE)

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