Components/Installation

Installation

Installing Tuffex and the three shapes an import can take

Since 0.4.0BETA

This component doc is in progress

This page is still being migrated. Demos and API details may change.

Install

Tuffex ships as @talex-touch/tuffex. Vue 3 is a peer dependency, so the app owns the Vue version.

EXAMPLE.BASH
# pnpm (recommended)
pnpm add @talex-touch/tuffex

# npm
npm install @talex-touch/tuffex

# yarn
yarn add @talex-touch/tuffex

The chart family is a separate package — installing Tuffex does not bring it in:

EXAMPLE.BASH
pnpm add @talex-touch/tuffex-charts

Three ways to import

The package exposes a root entry, three suite barrels, and one subpath per component. Which one you reach for is a bundle-size decision, not a feature one — the components are identical through all three.

ShapeImportUse it when
Per component@talex-touch/tuffex/buttonNew code. Only what you name is bundled.
Suite barrel@talex-touch/tuffex/baseA screen leans on most of one suite.
Root@talex-touch/tuffexMigration only — pulls the whole library.
EXAMPLE.TYPESCRIPT
import { createApp } from 'vue'
import TxButton from '@talex-touch/tuffex/button'
import TxSwitch from '@talex-touch/tuffex/switch'
import '@talex-touch/tuffex/base.css'
import '@talex-touch/tuffex/button/style.css'
import '@talex-touch/tuffex/switch/style.css'

const app = createApp(App)
app.use(TxButton)
app.use(TxSwitch)

Suite barrel

The base, pro and ai entries mirror the suite tabs in this sidebar. They partition the library exactly: every component belongs to one barrel and no barrel overlaps another — a rule the suite-barrels test enforces on every run, so a component can never silently drop out of its entry.

EXAMPLE.TYPESCRIPT
import TuffBase from '@talex-touch/tuffex/base'
import '@talex-touch/tuffex/base.css'

app.use(TuffBase)

Visualization components (SparkChart, AllocationBar, DiffTable, SignalMeter) import from the pro barrel even though the docs file them under the Data Suite: the suite split is a documentation shape, and the runtime entries stay base / pro / ai.

Root entry (migration)

EXAMPLE.TYPESCRIPT
import TuffUI from '@talex-touch/tuffex'
import '@talex-touch/tuffex/style.css'

app.use(TuffUI)

Use this only where an application already expects every component style to be present. New pages should not.

Styles

Styles are not injected by the JavaScript — you import them.

StylesheetContainsNeeded
@talex-touch/tuffex/base.css--tx-* tokens, resets, theme selectorsAlways, exactly once
@talex-touch/tuffex/<name>/style.cssOne component's CSSPer component you import
@talex-touch/tuffex/style.cssEvery component's CSSRoot-entry migrations only

base.css is what defines the design tokens the components read, so it is the one import that is never optional. See Theming for what it puts on the page and how to override it.

Utils

The helper layer the components themselves use is exported from both the root entry and a ./utils subpath:

EXAMPLE.TYPESCRIPT
import { nextZIndex, toast } from '@talex-touch/tuffex/utils'

The full API is in Utils.

Source

  • Entry map: packages/tuffex/package.json (exports) — ., ./utils, ./base.css, ./style.css, ./*, ./*/style.css.
  • Suite barrels: packages/tuffex/packages/components/src/{base,pro,ai}/index.ts.
  • Verified coverage: packages/tuffex/packages/components/src/__tests__/suite-barrels.test.ts asserts the three barrels partition components.ts exactly; global-install.test.ts covers the root-entry install path.