ct-components
npx skills add https://github.com/conectate/ct-elements --skill ct-components
Agent 安装分布
Skill 文档
Conectate Components (ct-components)
Conectate Components is a library of web components published as @conectate/components. Use this skill when building UIs with Lit, Vue, or React and the project uses or should use these components.
Installation
pnpm i @conectate/components
# or
npm i @conectate/components
Base class CtLit
For Lit-based components, extend CtLit instead of LitElement to get utilities:
import { CtLit, customElement, html } from "@conectate/components/ct-lit.js";
@customElement("my-component")
class MyComponent extends CtLit {
render() {
return html`<div>My component</div>`;
}
}
$$(selector)â first match in shadow root.$$$(selector)â all matches.fire(name, detail)â dispatch custom event withdetail.scrollToY(scrollTargetY, time?, easing?, target?)â animated scroll.deepClone(object)â deep clone (structuredClone or JSON fallback).
Full API: docs/ct-lit/lit.md.
Imports
Always import the component script before use. One import per component:
import "@conectate/components/ct-button";
import "@conectate/components/ct-input";
import "@conectate/components/ct-dialog";
Path pattern: @conectate/components/<component-name>.
Components (overview)
Use each tag only after importing its script. For full props, slots, and CSS variables, see the linked docs.
| Category | Component | Doc | Typical use |
|---|---|---|---|
| Base | CtLit | lit.md | Base class for Lit components |
| Buttons | ct-button | button.md | raised, flat, shadow, light; slots prefix/suffix |
| ct-button-menu | button-menu.md | Button with dropdown menu | |
| ct-button-split | button-split.md | Split button + menu | |
| ct-icon-button | icon-button.md | Icon-only button | |
| Inputs | ct-input | input.md | Text input with label, errorMessage, charCounter |
| ct-textarea | textarea.md | Multiline input | |
| ct-textarea-autogrow | textarea-autogrow.md | Auto-growing textarea | |
| ct-input-autocomplete | input-autocomplete.md | Input with suggestions | |
| ct-input-phone, ct-phone-input | input-phone.md, phone-input.md | Phone number input | |
| ct-date | date.md | Date picker | |
| ct-checkbox | checkbox.md | Checkbox | |
| ct-radio | radio.md | Radio group | |
| Dialogs & overlay | ct-dialog | dialog.md | Modal via showCtDialog(content); animations alert, slide-right, bottom-sheet |
| ct-card-dialog | card-dialog.md | Card-style dialog | |
| ct-bottom-sheet | bottom-sheet.md | Bottom sheet | |
| ct-confirm | confirm.md | Confirmation dialog | |
| Selection | ct-select | select.md | Single/multi select; items, value, searchable; event value with e.detail.value |
| ct-select-dialog, ct-select-item | select-dialog.md, select-item.md | Building blocks for select UIs | |
| Feedback | ct-loading, ct-loading-bar, ct-loading-placeholder | loading.md, loading-bar.md, loading-placeholder.md | Loading states |
| ct-spinner | spinner.md | Spinner | |
| ct-snackbar | snackbar.md | Toast/snackbar | |
| Layout & content | ct-card | card.md | Card container |
| ct-menu | menu.md | Menu / dropdown | |
| ct-tabs, ct-tab | tabs.md, tab.md | Tabs | |
| ct-collapse | collapse.md | Collapsible section | |
| ct-list-item | list-item.md | List item | |
| ct-icon | icon.md | Icon | |
| ct-img | img.md | Image | |
| ct-tooltip | tooltip.md | Tooltip | |
| Utilities | ct-helpers | helpers.md | getClient, getGeoLocation, sleep, PushID |
| ct-router | router.md | Routing | |
| ct-scroll-threshold | scroll-threshold.md | Infinite scroll trigger |
More components and containers: reference.md.
Uso con Lit / Vue / React
- Lit: Import the component
.js, then use the tag. Bind with.property=${value}, events with@eventname=${handler}. For custom events,e.detailholds the payload. - Vue: Import the component
.js. Usev-modelwhere supported (e.g. ct-input, ct-select). Events:@value,@input, etc. - React: Import the component
.js. UseonClick,onChange,onValue(for custom events,e.detail). Declare JSX types forct-*if needed (see docs examples).
Minimal examples
Lit (ct-button):
import { LitElement, html } from "lit";
import "@conectate/components/ct-button.js";
class MyEl extends LitElement {
render() {
return html`<ct-button raised @click=${() => console.log("ok")}>Click</ct-button>`;
}
}
Vue (ct-input):
<template>
<ct-input label="Name" v-model="name" />
</template>
<script setup>
import "@conectate/components/ct-input.js";
import { ref } from "vue";
const name = ref("");
</script>
React (ct-select):
import "@conectate/components/ct-select.js";
<ct-select label="Choice" items={items} value={val} onValue={(e) => setVal(e.detail.value)} />
For full examples per component, see the docs (e.g. button.md, input.md).
Slots
Many components use default, prefix, and suffix slots. Check each componentâs doc for exact slot names and behavior.
<ct-button raised>
<span slot="prefix">â</span>
Label
<span slot="suffix">â</span>
</ct-button>
CSS variables
Components are themed via CSS custom properties (e.g. --color-primary, --border-radius, --ct-button-radius). Set them on the host, a wrapper, or :root. See each componentâs doc for the full list.
ct-button {
--color-primary: #00aeff;
--ct-button-radius: 26px;
}
Eventos
- Native events:
click,input,change,blur, etc. Use as in standard HTML. - Custom events carry data in
event.detail. Example: ct-select firesvaluewithdetail.value(anddetail.old). In Lit:@value=${(e) => this.value = e.detail.value}.
For event names and payloads per component, see the corresponding doc in docs/.
Resources
Index of components and their documentation. All paths are relative to this skill (e.g. examples/ct-button.md).
For usage patterns, props, slots, CSS variables, and events, open the linked doc for each component.