or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

animation-timing.mdborder-utilities.mdbrowser-support.mdcolor-functions.mdform-input-selectors.mdindex.mdlayout-positioning.mdmathematical-utilities.mdshapes-graphics.mdtext-content.mdtypography.md
tile.json

form-input-selectors.mddocs/

Form and Input Selectors

Pre-built selector variables for targeting form inputs and buttons with pseudo-classes, enabling consistent styling across different input types and states.

Capabilities

Button Selectors

Pre-compiled selector lists for all HTML button elements with various pseudo-class combinations.

/**
 * List of all HTML button elements
 * Must be interpolated with #{} to use as selector
 */
$all-buttons: /* compiled button selectors */;

/**
 * List of all HTML button elements with :active pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-buttons-active: /* compiled button:active selectors */;

/**
 * List of all HTML button elements with :focus pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-buttons-focus: /* compiled button:focus selectors */;

/**
 * List of all HTML button elements with :hover pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-buttons-hover: /* compiled button:hover selectors */;

Usage Examples:

#{$all-buttons} {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
}
// Result:
// button,
// [type='button'],
// [type='reset'],
// [type='submit'] {
//   background-color: #3498db;
//   color: white;
//   border: none;
//   padding: 12px 24px;
//   border-radius: 4px;
//   cursor: pointer;
// }

#{$all-buttons-hover} {
  background-color: #2980b9;
}

#{$all-buttons-active} {
  background-color: #21618c;
  transform: translateY(1px);
}

#{$all-buttons-focus} {
  outline: 2px solid #85c1e9;
  outline-offset: 2px;
}

Text Input Selectors

Pre-compiled selector lists for all text-based HTML input elements with various pseudo-class combinations.

/**
 * List of all text-based HTML input elements
 * Must be interpolated with #{} to use as selector
 */
$all-text-inputs: /* compiled text input selectors */;

/**
 * List of all text-based HTML inputs with :active pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-text-inputs-active: /* compiled text input:active selectors */;

/**
 * List of all text-based HTML inputs with :focus pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-text-inputs-focus: /* compiled text input:focus selectors */;

/**
 * List of all text-based HTML inputs with :hover pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-text-inputs-hover: /* compiled text input:hover selectors */;

/**
 * List of all text-based HTML inputs with :invalid pseudo-class
 * Must be interpolated with #{} to use as selector
 */
$all-text-inputs-invalid: /* compiled text input:invalid selectors */;

Usage Examples:

#{$all-text-inputs} {
  border: 1px solid #bdc3c7;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  background-color: white;
}
// Result:
// [type='color'],
// [type='date'],
// [type='datetime'],
// [type='datetime-local'],
// [type='email'],
// [type='month'],
// [type='number'],
// [type='password'],
// [type='search'],
// [type='tel'],
// [type='text'],
// [type='time'],
// [type='url'],
// [type='week'],
// input:not([type]),
// textarea {
//   border: 1px solid #bdc3c7;
//   padding: 8px 12px;
//   border-radius: 4px;
//   font-size: 14px;
//   line-height: 1.4;
//   background-color: white;
// }

#{$all-text-inputs-focus} {
  border-color: #3498db;
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

#{$all-text-inputs-hover} {
  border-color: #95a5a6;
}

#{$all-text-inputs-invalid} {
  border-color: #e74c3c;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

Complete Form Styling Examples

Basic Form Theme

// Form container
.form {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

// Text inputs
#{$all-text-inputs} {
  width: 100%;
  border: 2px solid #ecf0f1;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  
  &::placeholder {
    color: #95a5a6;
  }
}

#{$all-text-inputs-focus} {
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#{$all-text-inputs-invalid} {
  border-color: #e74c3c;
  
  &:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
  }
}

// Buttons
#{$all-buttons} {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

#{$all-buttons-hover} {
  background-color: #2980b9;
  transform: translateY(-1px);
}

#{$all-buttons-active} {
  transform: translateY(0);
}

#{$all-buttons-focus} {
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

Material Design Form

.material-form {
  #{$all-text-inputs} {
    border: none;
    border-bottom: 2px solid #e0e0e0;
    border-radius: 0;
    padding: 8px 0;
    background: transparent;
    transition: border-bottom-color 0.3s ease;
  }
  
  #{$all-text-inputs-focus} {
    border-bottom-color: #2196f3;
    box-shadow: none;
  }
  
  #{$all-text-inputs-invalid} {
    border-bottom-color: #f44336;
  }
  
  #{$all-buttons} {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
  }
  \n  #{$all-buttons-hover} {\n    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);\n    transform: translateY(-2px);\n  }\n}\n```\n\n### Accessible Form Design\n\n```scss\n.accessible-form {\n  #{$all-text-inputs} {\n    border: 2px solid #666;\n    padding: 12px 16px;\n    font-size: 18px;\n    line-height: 1.5;\n    \n    &:required {\n      border-left: 4px solid #e67e22;\n    }\n  }\n  \n  #{$all-text-inputs-focus} {\n    border-color: #2c3e50;\n    outline: 3px solid #f39c12;\n    outline-offset: 2px;\n  }\n  \n  #{$all-text-inputs-invalid} {\n    border-color: #c0392b;\n    \n    &:focus {\n      outline-color: #c0392b;\n    }\n  }\n  \n  #{$all-buttons} {\n    background-color: #27ae60;\n    color: white;\n    border: 3px solid #27ae60;\n    padding: 16px 32px;\n    font-size: 18px;\n    font-weight: bold;\n    \n    &:disabled {\n      background-color: #95a5a6;\n      border-color: #95a5a6;\n      cursor: not-allowed;\n    }\n  }\n  \n  #{$all-buttons-focus} {\n    outline: 3px solid #f39c12;\n    outline-offset: 3px;\n  }\n}\n```\n\n### Dark Theme Form\n\n```scss\n.dark-form {\n  background-color: #2c3e50;\n  color: #ecf0f1;\n  \n  #{$all-text-inputs} {\n    background-color: #34495e;\n    border: 1px solid #546b7a;\n    color: #ecf0f1;\n    \n    &::placeholder {\n      color: #95a5a6;\n    }\n  }\n  \n  #{$all-text-inputs-focus} {\n    border-color: #3498db;\n    background-color: #2c3e50;\n  }\n  \n  #{$all-text-inputs-invalid} {\n    border-color: #e74c3c;\n    background-color: rgba(231, 76, 60, 0.1);\n  }\n  \n  #{$all-buttons} {\n    background-color: #3498db;\n    border: 1px solid #3498db;\n  }\n  \n  #{$all-buttons-hover} {\n    background-color: #2980b9;\n    border-color: #2980b9;\n  }\n}\n```\n\n## Selector Coverage\n\nThe selector variables cover these HTML elements:\n\n**Button Elements:**\n- `button`\n- `[type='button']`\n- `[type='reset']`\n- `[type='submit']`\n\n**Text Input Elements:**\n- `[type='color']`\n- `[type='date']`\n- `[type='datetime']`\n- `[type='datetime-local']`\n- `[type='email']`\n- `[type='month']`\n- `[type='number']`\n- `[type='password']`\n- `[type='search']`\n- `[type='tel']`\n- `[type='text']`\n- `[type='time']`\n- `[type='url']`\n- `[type='week']`\n- `input:not([type])`\n- `textarea`"