npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2025 – Pkg Stats / Ryan Hefner

tgui-angular

v2.2.13

Published

πŸš€ Angular UI library for Telegram Web Apps with modern components and theming support | πŸ’Ό Author is open to work opportunities | πŸ“§ Contact: [email protected] | πŸ’¬ Telegram: @ablagovestnov

Readme

TGUI Angular

Comprehensive Angular UI library for building Telegram Web Apps with modern components and theming support.

TON Society Bounty

This project is being developed as part of the TON Society bounty program:

Installation

npm install tgui-angular

Importing Styles

To use TGUI Angular components with proper styling, you need to import the library's CSS files. Choose one of the methods below:

Method 1: Via angular.json (Recommended)

Add the styles to your angular.json file:

{
  "projects": {
    "your-app": {
      "architect": {
        "build": {
          "options": {
            "styles": [
              "src/styles.css",
              "node_modules/tgui-angular/styles/index.css"
            ]
          }
        }
      }
    }
  }
}

Note: Thanks to package.json exports, you can also use the shorter path in CSS imports (but angular.json requires the full path).

Method 2: Via styles.css

Import the styles in your main src/styles.css file:

/* Full styles import */
@import 'tgui-angular/styles';

/* Or explicitly specify the file */
@import 'tgui-angular/styles/index.css';

/* Your custom styles */

Method 3: Import Only Variables

If you only need the CSS variables for custom styling:

@import 'tgui-angular/styles/variables.css';

/* Your custom components using TGUI variables */
.my-component {
  background-color: var(--tgui--bg_color);
  color: var(--tgui--text_color);
  padding: var(--tgui--text--line_height);
}

Available Style Files

  • index.css - Complete styles (includes variables + utility classes)
  • variables.css - Only CSS custom properties for theming

Quick Start

Standalone Application Setup (Recommended)

// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';

export const appConfig: ApplicationConfig = {
  providers: [
    // Your other providers
  ]
};

// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

bootstrapApplication(AppComponent, appConfig);
// app.component.ts
import { Component } from '@angular/core';
import { RootComponent } from 'tgui-angular';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RootComponent],
  template: `
    <tgui-root>
      <!-- Your app content -->
      <h1>Hello Telegram Web App!</h1>
    </tgui-root>
  `
})
export class AppComponent {}

Core Components

Root Component

The tgui-root component is required and serves as the foundation for your app:

<tgui-root [platform]="'ios'" [appearance]="'dark'">
  <!-- All your app content goes here -->
</tgui-root>

Features:

  • Automatic theme detection (light/dark)
  • Platform-specific styling (iOS/base)
  • CSS variables injection
  • Portal container for overlays

Available Components

Blocks (UI Building Blocks)

import { 
  BadgeComponent,
  ButtonComponent,
  AvatarComponent,
  AvatarStackComponent,
  SectionComponent,
  CardComponent,
  IconButtonComponent,
  ImageComponent,
  ImageBadgeComponent,
  IconContainerComponent,
  PlaceholderComponent,
  ListComponent,
  StepsComponent,
  TimelineComponent,
  TimelineItemComponent,
  AccordionComponent,
  AccordionSummaryComponent,
  AccordionContentComponent
} from 'tgui-angular';

Typography

import {
  TypographyComponent,
  CaptionComponent,
  HeadlineComponent,
  LargeTitleComponent,
  SubheadlineComponent,
  TextComponent,
  TitleComponent
} from 'tgui-angular';

Form Components

import {
  ChipComponent,
  FormInputComponent,
  FormInputTitleComponent,
  InputComponent,
  CheckboxComponent,
  ColorInputComponent,
  RadioComponent,
  FileInputComponent,
  PinInputComponent,
  RatingComponent,
  SelectComponent,
  SwitchComponent,
  TextareaComponent
} from 'tgui-angular';

Feedback Components

import {
  SpinnerComponent,
  SpoilerComponent,
  SkeletonComponent,
  ProgressComponent,
  CircularProgressComponent
} from 'tgui-angular';

Navigation Components

import {
  BreadcrumbsComponent,
  BreadcrumbsItemComponent,
  LinkComponent
} from 'tgui-angular';

Utility Components

import {
  TappableComponent,
  RippleComponent,
  RootPortalComponent,
  TouchComponent,
  RootRendererComponent
} from 'tgui-angular';

Services

Theme Service

import { Component } from '@angular/core';
import { ThemeService, AppearanceType } from 'tgui-angular';

@Component({
  selector: 'app-example',
  template: `
    <button (click)="toggleTheme()">
      Current theme: {{ currentTheme }}
    </button>
  `
})
export class ExampleComponent {
  currentTheme: AppearanceType = 'light';

  constructor(private themeService: ThemeService) {
    // Listen to theme changes
    this.themeService.appearance$.subscribe(theme => {
      this.currentTheme = theme;
    });
  }

  toggleTheme() {
    const newTheme = this.currentTheme === 'light' ? 'dark' : 'light';
    this.themeService.setAppearance(newTheme);
  }
}

Platform Service

import { Component } from '@angular/core';
import { PlatformService, PlatformType } from 'tgui-angular';

@Component({
  selector: 'app-example',
  template: `<div>Platform: {{ platform }}</div>`
})
export class ExampleComponent {
  platform: PlatformType = 'base';

  constructor(private platformService: PlatformService) {
    this.platformService.platform$.subscribe(platform => {
      this.platform = platform;
    });
  }
}

Telegram Service

import { Component } from '@angular/core';
import { TelegramService } from 'tgui-angular';

@Component({
  selector: 'app-example',
  template: `<div>Telegram WebApp detected: {{ isWebApp }}</div>`
})
export class ExampleComponent {
  isWebApp = false;

  constructor(private telegramService: TelegramService) {
    this.isWebApp = this.telegramService.isWebApp();
    
    if (this.isWebApp) {
      const webApp = this.telegramService.getWebApp();
      console.log('WebApp theme:', webApp?.colorScheme);
    }
  }
}

Portal System

Use portals to render content outside the normal component tree:

import { Component } from '@angular/core';
import { RootComponent, RootPortalComponent } from 'tgui-angular';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RootComponent, RootPortalComponent],
  template: `
    <tgui-root>
      <div>Main content</div>
      
      <!-- This will be rendered at the root level -->
      <tgui-root-portal>
        <div class="modal">Modal content</div>
      </tgui-root-portal>
    </tgui-root>
  `
})
export class AppComponent {}

Theming

The library automatically adapts to:

  1. Telegram WebApp theme (when running in Telegram)
  2. System theme preferences (when running in browser)

Manual Theme Control

<!-- Force dark theme -->
<tgui-root appearance="dark">
  <!-- Your content -->
</tgui-root>

<!-- Force iOS platform styling -->
<tgui-root platform="ios">
  <!-- Your content -->
</tgui-root>

CSS Variables

All components use CSS variables for consistent theming:

.my-custom-component {
  background-color: var(--tgui--bg_color);
  color: var(--tgui--text_color);
  border: 1px solid var(--tgui--outline);
}

Example Usage

import { Component } from '@angular/core';
import { 
  RootComponent,
  ButtonComponent,
  TextComponent,
  HeadlineComponent,
  SpinnerComponent
} from 'tgui-angular';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [
    RootComponent,
    ButtonComponent,
    TextComponent,
    HeadlineComponent,
    SpinnerComponent
  ],
  template: `
    <tgui-root>
      <tgui-headline>Welcome to TGUI Angular</tgui-headline>
      <tgui-text>A modern UI library for Telegram Web Apps</tgui-text>
      
      <tgui-button 
        mode="filled" 
        size="m"
        (click)="handleClick()">
        Click me!
      </tgui-button>
      
      <tgui-spinner *ngIf="loading" size="m" />
    </tgui-root>
  `
})
export class ExampleComponent {
  loading = false;

  handleClick() {
    this.loading = true;
    // Your logic here
  }
}

Demo

You can explore TGUI Angular in action:

Requirements

  • Angular 19.0.0 or higher
  • Node.js 18.19.1, 20.11.1, or 22.0.0
  • TypeScript 5.7 or higher

Browser Support

  • Chrome/Chromium 88+
  • Firefox 85+
  • Safari 14+
  • Edge 88+

Documentation

For detailed component documentation and examples, visit our Storybook documentation.

For theming details, see THEMING.md.

Contributing

We welcome contributions! Please see our contributing guidelines for more information.

License

MIT License - see LICENSE file for details.

Author

Alexander Blagovestnov

Author is open to work opportunities.