Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@patternfly/pfe-card

Package Overview
Dependencies
Maintainers
12
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patternfly/pfe-card

Cards for PatternFly Elements

  • 1.0.0-prerelease.55
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
281
increased by27.15%
Maintainers
12
Weekly downloads
 
Created
Source

PFElements Card Element

Usage

<pfe-card>
  <h2 slot="pfe-card--header">Card header</h2>
  <p>This is the pfe-card body.</p>
  <pfe-cta slot="pfe-card--footer">
    <a href="#">Footer link</a>
  </pfe-cta>
</pfe-card>

Slots

All slots are optional. If the slot is not defined, the content will be added to the body region of the card.

Header

If this slot is used, we expect a heading level tag (h1, h2, h3, h4, h5, h6). An icon, svg, or use of the icon component are also valid in this region.

Default slot (body)

Any content that is not designated for the header or footer slot, will go to this slot.

Use this slot for anything that you want to be stuck to the base of the card. This region is bottom-aligned.

Attributes

.color-preview { display: inline-block; width: 1em; height: 1em; vertical-align: middle; background-color: var(--bg, #ffffff); border: 1px solid #444444; }

There are several attributes available for customizing the visual treatment of this container.

  • pfe-color: Options include darkest, darker, accent, complement, lighter, lightest. The card has a default value of #dfdfdf. Your theme will influence these colors so check there first if you are seeing inconsistencies.

    colorhex
    lightest #ffffff
    lighter #ececec
    default #dfdfdf
    darker #464646
    darkest #131313
    accent #ee0000
    complement #0477a4
  • pfe-img-src: Optional background image applied to the entire card container. Alignment of this image can be managed using the --pfe-card--BackgroundPosition variable which is set to center center by default.

  • pfe-size: Optionally adjusts the padding on the container. Accepts: small.

  • pfe-overflow: Optionally allows an image or element to overflow the padding on the container. This property should be added to the direct child of the slotm such as on an image tag; should be added to the element that you want to overflow the container. Accepts: top, right, bottom, left.

  • pfe-border: Optionally apply a border color and weight to the entire card container. The default color and weight is #d2d2d2 and 1px, respectively.

Variables

There are several powerful variables available to hook into and override default styles.

  • Background color: Though using the pfe-color attribute is strongly recommended when setting the background color for the band, you can also use completely custom colors by updating the --pfe-band--BackgroundColor variable. If you update this value manually, you should also update the --theme context variable to invoke the right theme on it and it's child elements. Supported themes include: light, dark, and saturated.
  • Background position: This is designed for use with the pfe-img-src attribute to allow you to align your background image. Default value is center center. Variable name: --pfe-card--BackgroundPosition.
  • Border: This allows the customization of a border around the entire container. There is a variable for the entire border shorthand (transparent by default) or you can hook into the individual properties. Variable name: --pfe-card--BorderRadius and --pfe-card--Border or --pfe-card--BorderWeight, --pfe-card--BorderStyle, --pfe-card--BorderColor.
  • Padding: You can customize the padding around the outside of the card container by connecting to either the shortcut padding variable or just one or more of the individual padding regions. Variable names: --pfe-card--Padding or --pfe-card--PaddingTop, --pfe-card--PaddingRight, --pfe-card--PaddingBottom, --pfe-card--PaddingLeft.

Test

npm run test

Build

npm run build

Demo

From the PFElements root directory, run:

npm start

Code style

Card (and all PFElements) use Prettier to auto-format JS and JSON. The style rules get applied when you commit a change. If you choose to, you can integrate your editor with Prettier to have the style rules applied on every save.

Keywords

FAQs

Package last updated on 19 Aug 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc