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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sn-textarea

v0.0.5

Published

Angular textarea component with auto-resize and character counter - SnUI Library

Readme

sn-textarea

A customizable and accessible multi-line text input component for Angular applications with auto-resize and character counter support.

Overview

The sn-textarea component provides a modern, styled textarea input with support for:

  • ✅ Multi-line text input
  • ✅ Auto-resize based on content (optional)
  • ✅ Character counter with max length support
  • ✅ Disabled and readonly states
  • ✅ Custom labels and placeholders
  • ✅ Form control integration (ControlValueAccessor)
  • ✅ Full accessibility support (ARIA labels)
  • ✅ Keyboard navigation
  • ✅ Customizable row height

Installation

npm install sn-textarea

Usage

Basic Textarea

import { Component } from '@angular/core';
import { SnTextareaComponent } from 'sn-textarea';

@Component({
  selector: 'app-demo',
  template: `
    <sn-textarea 
      id="comments"
      label="Comments"
      placeholder="Enter your comments"
      (changed)="onChanged($event)"
    ></sn-textarea>
  `,
  imports: [SnTextareaComponent]
})
export class DemoComponent {
  onChanged(value: string): void {
    console.log('Value:', value);
  }
}

With Reactive Forms

import { Component } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { SnTextareaComponent } from 'sn-textarea';

@Component({
  selector: 'app-form',
  template: `
    <form [formGroup]="form">
      <sn-textarea 
        id="bio"
        label="Bio"
        placeholder="Tell us about yourself"
        formControlName="bio"
      ></sn-textarea>
    </form>
  `,
  imports: [SnTextareaComponent, ReactiveFormsModule]
})
export class FormComponent {
  form: FormGroup;

  constructor(fb: FormBuilder) {
    this.form = fb.group({
      bio: ['']
    });
  }
}

With Character Counter

import { Component } from '@angular/core';
import { SnTextareaComponent } from 'sn-textarea';

@Component({
  selector: 'app-counter',
  template: `
    <sn-textarea 
      id="description"
      label="Description"
      placeholder="Max 500 characters"
      [maxLength]="500"
      [(ngModel)]="description"
    ></sn-textarea>
  `,
  imports: [SnTextareaComponent]
})
export class CounterComponent {
  description: string = '';
}

With Auto-Resize

<sn-textarea 
  id="feedback"
  label="Feedback"
  placeholder="Type your feedback"
  [autoResize]="true"
  [rows]="4"
></sn-textarea>

Readonly State

<sn-textarea 
  id="readonly-text"
  label="Read Only"
  value="This is read-only content"
  [readonly]="true"
></sn-textarea>

API

Inputs

| Input | Type | Default | Description | |-------|------|---------|-------------| | id | string | '' | HTML id attribute for the textarea | | label | string | '' | Label text displayed above the textarea | | placeholder | string | '' | Placeholder text for the textarea | | name | string | '' | HTML name attribute | | rows | number | 4 | Number of rows to display | | maxLength | number \| null | null | Maximum character length allowed | | disabled | boolean | false | Whether the textarea is disabled | | autoResize | boolean | true | Auto-resize textarea based on content | | readonly | boolean | false | Whether the textarea is readonly |

Outputs

| Output | Type | Description | |--------|------|-------------| | changed | EventEmitter<string> | Emitted when textarea value changes |

Features

Auto-Resize

When autoResize is enabled, the textarea automatically adjusts its height based on the content, making it ideal for dynamic content.

Character Counter

When maxLength is set, a character counter is displayed showing current / max characters. This helps users understand how much space they have left.

Form Integration

The component works seamlessly with both Reactive Forms and Template Forms through the ControlValueAccessor interface.

Styling

The component uses Tailwind CSS for styling. It includes:

  • Blue color scheme for focus states
  • Smooth transitions and hover effects
  • Focus states with shadow effects
  • Disabled and readonly state styling
  • Dark and light mode compatible
  • Responsive sizing

Testing

ng test sn-textarea

Building

ng build sn-textarea

Accessibility

The component includes:

  • Proper ARIA labels for screen readers
  • Keyboard navigation support (Tab, Enter for new lines)
  • Focus indicators
  • Semantic HTML structure
  • Character counter for users with visual limitations
  • Label associated with textarea via id attribute