Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@rei/cdr-button
Advanced tools
For the most up-to-date information, see REI Cedar documentation.
Name | Type | Default |
---|---|---|
tag | string | button |
Renders CdrButton as a <button> or <a> element. When using the value of <a>, this element renders as an achor link. Possible values: { 'button' | 'a' } |
Name | Type | Default |
---|---|---|
type | string | button |
Sets the button type. Possible values: { 'button' | 'submit' | 'reset' } |
Name | Type | Default |
---|---|---|
onClick | function | return null |
Adds custom click actions. |
Name | Type | Default |
---|---|---|
fullWidth | boolean | false |
Sets button width to 100%. Setting it to true will set the button width to 100% of the parent container. Use the full-width prop with the size prop to control top and bottom padding. |
Name | Type | Default |
---|---|---|
size | string | medium |
Sets the button size; values can target responsive breakpoints. Breakpoint values are: xs, sm, md, and lg. Examples: { 'small' | 'medium' | 'large' |
Name | Type | Default |
---|---|---|
iconOnly | boolean | false |
Renders an icon-only button. When this value is true, it will override the size and responsiveSize props |
Name | Type | Default |
---|---|---|
onDark | boolean | false |
Renders an icon-only button with a light fill color for use on dark backgrounds. The 'iconOnly' prop must be true. |
Name | Type | Default |
---|---|---|
modifier | string | n/a |
Modifies the style variant for this component. Possible values: { 'secondary' } |
All CdrButton components have two slots.
Name | Notes |
---|---|
Default | Slot for button text. Leave empty if icon-only |
icon | Slot for the icon |
Resources are available within the CdrButton package:
Name | Type | Description |
---|---|---|
@rei/cdr-button | Node module package | Import the component into your project |
cdr-button.css | Style sheet | Component specific styles |
To incorporate the required assets for a component, use the following steps:
Install the CdrButton package using npm
in your terminal:
Terminal
npm i -s @rei/cdr-button
main.js
// import your required css.
import "@rei/cdr-link/dist/cdr-button.css";
In this example we’ll create a medium-sized primary button, which is the default.
local.vue
<template>
<cdr-button
type="button"
>
Add to cart
</cdr-button>
</template>
<script>
import { CdrButton } from '@rei/cdr-button';
export default {
...
components: {
CdrButton
}
}
</script>
The below example uses the size
prop to set default and responsive size. This button’s size is small, but it will become a large button at the xs
and sm
breakpoints.
<template>
<cdr-button
size="small large@xs large@sm"
>
Add to cart
</cdr-button>
</template>
Following variants are available to the cdr-button
modifier attribute:
Value | Description |
---|---|
secondary | Sets the secondary style for the button |
Use the on-click
prop to attach custom actions and event handling.
<template>
<cdr-button
:on-click="greet"
>
Greet
</cdr-button>
</template>
<script>
export default {
...
methods: {
greet() {
console.log(‘Hello there’);
}
}
}
</script>
CdrButton can be used with the icon component from the CdrIcon package.
To scale Cedar icons appropriately, include the cdr-button__icon
class with any icon component. The size
prop scales both the icon and button.
In the below example, a Download button is rendered as a button with icon and text using cdr-icon
and the icon sprite.
<template>
<cdr-button>
<cdr-icon
slot="icon"
class="cdr-button__icon"
use="#download"
/>
Download
</cdr-button>
</template>
<script>
import { CdrButton } from '@rei/cdr-button';
import { CdrIcon } from '@rei/cdr-icon';
export default {
...
components: {
CdrButton,
CdrIcon,
}
}
</script>
Use the following props to modify cdr-button
:
size
prop is disable when icon-only
prop is truefill
color is dark, assign true to the on-dark
propon-dark
prop only works if icon-only
prop is also truearia-label
text to describe the button’s action when clicked or tapped<template>
<cdr-button
:icon-only="true"
:on-dark="true"
aria-label="Complete this step"
>
<icon-check-lg
slot="icon"
class="cdr-button__icon" />
</cdr-button>
</template>
The CdrButton package includes two specific icon-only variants. CdrCloseButton and CdrPlayButton include their respective icons and aria-label
text for accessibility.
<template>
<cdr-close-button />
</template>
<script>
import { CdrCloseButton } from '@rei/cdr-button';
export default {
...
components: {
CdrCloseButton
}
}
</script>
FAQs
REI Cedar Style Framework - Vue Component for Button
The npm package @rei/cdr-button receives a total of 1 weekly downloads. As such, @rei/cdr-button popularity was classified as not popular.
We found that @rei/cdr-button demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.