Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@workday/canvas-kit-css-form-field
Advanced tools
Readme
Form element styles and other common form styles.
yarn add @workday/canvas-kit-css
or
yarn add @workday/canvas-kit-css-form
Add your node_modules
directory to your SASS includePaths
. You will then be able to import
index.scss
.
@import '~@workday/canvas-kit-css-form/index.scss';
You must have PostCSS support. Add the postcss-inline-svg plugin to properly process and inline icons. Process your SASS through PostCSS once it has been compiled to CSS.
<form class="wdc-form">
<div class="wdc-form-field-wrapper">
<label class="wdc-form-label wdc-form-label-required" for="email">Email</label>
<div class="wdc-form-field wdc-form-textinput">
<input type="text" placeholder="email@address.com" id="email" />
</div>
</div>
<div class="wdc-form-field-wrapper">
<label class="wdc-form-label wdc-form-label-required" for="password">Password</label>
<div class="wdc-form-field wdc-form-textinput">
<input type="password" id="password" />
</div>
</div>
</form>
Form labels are rendered above the fields by default. You can enable inline labels (side by side),
by applying the .wdc-form-label-position-left
class to .wdc-form
.
<div class="wdc-form wdc-form-label-position-left">
<div class="wdc-form-field-wrapper">
<label for="textinput" class="wdc-form-label wdc-form-label-required">Input Label</label>
<div class="wdc-form-field wdc-form-textinput">
<input type="text" placeholder="Here's a placeholder" id="textinput" />
</div>
</div>
</div>
If you need to toggle this programmatically (i.e. for mobile responsive), you can use the
wdc-form-label-position-left()
mixin.
@media (max-width: 640px) {
.wdc-form {
@include wdc-form-label-position-left();
}
}
If you need to hide your label visually please still include one and hide using the
.wdc-accessible-hide
class.
<label for="textinput" class="wdc-form-label wdc-accessible-hide">Label for screenreaders</label>
<div class="wdc-form-field wdc-form-textinput">
<input type="text" id="textinput" />
</div>
See canvas-kit-core for accessibility guidelines.
Form controls are available as both classes and mixins. Using the class is preferred.
Group form labels and fields using .wdc-form-field
.
Use .wdc-form-label
on <label>
elements.
Required field labels Labels for required fields should use .wdc-form-label-required
to add a
red asterisk next to the label. You can also add the required attribute to the input to get build in
required input behavior.
<div class="wdc-form-field-wrapper">
<label class="wdc-form-label wdc-form-label-required">Required Label</label>
<label class="wdc-form-label">Input Label</label>
<input required />
</div>
Use .wdc-form-error
or .wdc-form-alert
to apply error or alert styling to form controls.
Error styling is available as both classes and mixins. Using the class is preferred.
Example
<div class="wdc-form">
<div class="wdc-form-field-wrapper wdc-form-field-error">
<label class="wdc-form-label" for="input">Input Label</label>
<div class="wdc-form-field">
<div class="wdc-form-textinput wdc-form-error">
<input id="input" type="text" aria-describedby="error-message" aria-invalid="true" />
</div>
<div class="wdc-form-hint-message" id="error-message">
<strong>Error:</strong> Error message
</div>
</div>
</div>
</div>
Use .wdc-form-field-error
for errors and .wdc-form-field-alert
for alerts. Applying error and
alert styling will display an icon on the right inside the input.
Messages Add messages to errors and alerts by wrapping your message with
.wdc-form-hint-message
or .wdc-form-hint-message
. Using strong
will bolden text with the
respective error/alert color.
Place the message element after the form controls.
<div class="wdc-form-hint-message"><strong>Error:</strong> Error message</div>
<div class="wdc-form-hint-message"><strong>Alert:</strong> Alert message</div>
Use .wdc-form-error
/.wdc-form-alert
with .wdc-form-textinput
.
<div class="wdc-form">
<div class="wdc-form-field-wrapper wdc-form-field-error">
<label class="wdc-form-label" for="input">Input Label</label>
<div class="wdc-form-field">
<div class="wdc-form-textinput wdc-form-error">
<input id="input" type="text" aria-describedby="error-message" aria-invalid="true" />
</div>
<div class="wdc-form-hint-message" id="error-message">
<strong>Error:</strong> Error message
</div>
</div>
</div>
</div>
FAQs
The form css for canvas-kit-css
The npm package @workday/canvas-kit-css-form-field receives a total of 256 weekly downloads. As such, @workday/canvas-kit-css-form-field popularity was classified as not popular.
We found that @workday/canvas-kit-css-form-field demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.