Base

  • Colors
  • Icons
  • Logos
  • Spacing
  • Typography

Components

  • Accordion
  • Avatars
  • Badges
  • Buttons
  • Cards
  • Character Counter
  • Device Type Icons
  • Draggables
  • Dropdowns
  • Droppables
  • Filters
  • Gallery card
  • Indicators
  • Lists
  • Loading
  • Messages
  • Pictogram
  • Poster Play
  • Progress bar
  • QR Code
  • Rating stars
  • Row Selector
  • Sentiment
  • Split View
  • Tables
  • Tags
  • Tester vitals
  • Toast
  • Toggle button
  • Typeahead

Form

  • Checkbox
  • Combobox
  • Form Rule
  • Hint
  • Input
  • Input Title
  • Label
  • Multi-select List
  • Search
  • Select
  • Single-select List
  • Sliders
  • Switch
  • Tabs
  • Text Area

Layout

  • Containers
  • Layers
  • Layout
  • Split Layout
  • Wrappers

Navigation

  • Context Switcher
  • Nav bar
  • Navigation
  • Pagination
  • Sidebar Navigation
  • Step Navigation

Overlay

  • Banners
  • Bulk Selector
  • Modals
  • Popovers
  • Tooltips
  • User Notifications

Patterns

  • Full Page Message

Usertesting-next

  • Cards
  • Colors
  • Segmented Controls
  • Shadows and Elevations
  • Spacing
  • Typography

Visualizations

  • Data Colors

Character Counter

Wrap an input or textarea to keep count

Bottom counter

Expand Copy
<tk-character-counter
  count-down="true"
  input-size="medium"
  max-length="200"
  placement="bottom"
  text="Updated model value"
  warning-text="Try breaking down larger tasks and questions"
>
  <label class="form__label form__label--stacked">
    Task
    <textarea
      oninput="characterCountExampleChanged(event)"
      class="form-input form-input--textarea"
    ></textarea>
  </label>
</tk-character-counter>

<script>
  const characterCounterElement = document.getElementsByTagName('tk-character-counter')[0];
  const characterCountExampleChanged = (event) => {
    characterCounterElement.setAttribute('text', event.srcElement.value)
  }
</script>

Description

Wrap any input or textarea that needs a way to count its characters with <tk-character-counter>.

The input or textarea must provide a way to pass out the value being entered into the field so that the counter component can update the counts it checks against.

tk-character-counter

Properties

Property Attribute Description Type Default
countDown count-down Should the counter count down or up? boolean false
counterClass counter-class Extra classes to apply to the counter. string 'textarea__count'
hideCounter hide-counter Controls the visibility of the counter. boolean false
inputSize input-size When using with TkInput, give the input a size of fullwidth to make it take up the whole container. "fullwidth" | "large" | "medium" | "small" | "xs" 'fullwidth'
maxLength max-length The maximum number of characters allowed. number undefined
placement placement Determines the placement of the counter output. "bottom" | "top" 'top'
text text The value of the input that will be calculated based on the characters. string undefined
warningClass warning-class Classes to apply to warning text. string 'textarea__count--error'
warningText warning-text Text displayed when approaching character limit. string undefined