You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
Floating labels display the type of input a field requires. Every Text Field and Select should have a label, except for full-width text fields, which use the input's placeholder attribute instead. Labels are aligned with the input line and always visible. They can be resting (when a field is inactive and empty) or floating. The label is a text caption or description for the Text Field.
Generates a CSS @keyframes at-rule for an invalid label shake. Used in conjunction with the shake-animation mixin.
shake-animation($modifier)
Applies shake keyframe animation to label.
float-position($positionY, $positionX, $scale)
Sets position of label when floating.
max-width($max-width)
Sets the max width of the label.
float-transition($duration-ms, $timing-function)
Customizes the duration and optional timing function for the "float" transition.
MDCFloatingLabel Properties and Methods
Method Signature
Description
shake(shouldShake: boolean) => void
Proxies to the foundation's shake() method.
float(shouldFloat: boolean) => void
Proxies to the foundation's float() method.
setRequired(isRequired: boolean) => void
Proxies to the foundation's setRequired() method.
getWidth() => number
Proxies to the foundation's getWidth() method.
Usage Within Frameworks
If you are using a JavaScript framework, such as React or Angular, you can create a Floating Label for your framework. Depending on your needs, you can use the Simple Approach: Wrapping MDC Web Vanilla Components, or the Advanced Approach: Using Foundations and Adapters. Please follow the instructions here.