T
TailNG

Playground

Home tailng.com

Code Block

A docs-friendly code viewer with optional line numbers. Copy is implemented externally via tng-copy-button.

[content]
line numbers
wrap
klass overrides
copy (external)

Example (TypeScript)

safe
import { Component, input } from '@angular/core';

@Component({
  selector: 'tng-button',
  standalone: true,
  template: '<button>{{ label() }}</button>',
})
export class ButtonComponent {
  label = input<string>('Click me');
}

klass signal pattern

tailng
import { Component, computed, input } from '@angular/core';

@Component({
  selector: 'tng-button',
  standalone: true,
  template: '<button type="button" [class]="klass()"><ng-content /></button>',
})
export class ButtonComponent {
  variant = input<'primary' | 'outline'>('primary');

  klass = computed(() => {
    const base = 'rounded-md px-3 py-2 text-sm font-semibold';
    const primary = 'bg-[color:var(--primary)] text-white';
    const outline = 'border border-slate-200 text-slate-800';

    return [base, this.variant() === 'primary' ? primary : outline].join(' ');
  });
}

Wrap enabled

wrap=true
import { Component, computed, input } from '@angular/core';

@Component({
  selector: 'tng-button',
  standalone: true,
  template: '<button type="button" [class]="klass()"><ng-content /></button>',
})
export class ButtonComponent {
  variant = input<'primary' | 'outline'>('primary');

  klass = computed(() => {
    const base = 'rounded-md px-3 py-2 text-sm font-semibold';
    const primary = 'bg-[color:var(--primary)] text-white';
    const outline = 'border border-slate-200 text-slate-800';

    return [base, this.variant() === 'primary' ? primary : outline].join(' ');
  });
}

JSON

wrap + lines
{
  "name": "tailng",
  "tagline": "Scalability of Angular. Simplicity of Tailwind.",
  "openSource": true
}

Klass overrides

theming
npm i @tailng-ui/ui

Default copy button

theming

Possible next features

  • code group: combine HTML/TS/CSS using tng-tab-panel
  • maxHeight: cap height with internal scroll
  • highlight: optional Prism / Shiki adapter
Contribute on GitHub