4.4.12 • Published 6 months ago

@conectate/ct-button v4.4.12

Weekly downloads
11
License
BSD-3-Clause
Repository
github
Last release
6 months ago

A customizable button web component with various styles and configurations.

Installation

Install via npm or pnpm:

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

Basic Usage

<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:

import "@conectate/ct-button";

Example with LitElement (TypeScript)

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

PropertyAttributeTypeDefaultDescription
raisedraisedbooleanfalseRaised Style (primary color)
shadowshadowbooleanfalseShown with opaque black background.
flatflatbooleanfalseShown with a primary color border
lightlightbooleanfalseShown with a primary color border
disableddisabledbooleanfalseIf true, Disable clicks
typetypestring"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:

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://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

4.4.12

6 months ago

4.4.9

6 months ago

4.4.8

8 months ago

4.4.5

8 months ago

4.4.7

8 months ago

4.4.6

8 months ago

4.3.1

9 months ago

4.3.4

8 months ago

4.3.0

9 months ago

4.1.0

1 year ago

4.0.0

1 year ago

3.12.9

2 years ago

3.12.4

2 years ago

3.9.0

2 years ago

3.11.0

2 years ago

3.8.0

2 years ago

3.10.0

2 years ago

3.12.1

2 years ago

3.12.0

2 years ago

3.11.1

2 years ago

3.7.6

2 years ago

3.7.5

3 years ago

3.7.3

3 years ago

3.7.2

3 years ago

3.7.0

3 years ago

3.6.4

4 years ago

3.6.3

4 years ago

3.6.0

4 years ago

3.5.12

4 years ago

3.5.11

4 years ago

3.5.7

4 years ago

3.5.5

4 years ago

3.5.8

4 years ago

3.5.3

4 years ago

3.5.2

4 years ago

3.5.1

4 years ago

3.5.0

4 years ago

3.5.4

4 years ago

3.4.0

4 years ago

3.3.0

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.0.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago