Card

Summary
Default

card-default

PBCard {
  Text("Card Content").pbFont(.body)
 }
Card Backgrounds

card-background-colors

VStack(alignment: .leading, spacing: Spacing.small) {
  PBCard {
    Text(text).pbFont(.body)
  }

  PBCard(backgroundColor: .background(.light)) {
    Text("Light").pbFont(.body, color: .text(.light))
  }

  PBCard(backgroundColor: .background(.dark)) {
    Text("Dark").pbFont(.body, color: .text(.light))
  }

  PBCard(backgroundColor: .product(.product1, category: .background)) {
    Text("Product 1 Background").pbFont(.body, color: .white)
  }

  PBCard(backgroundColor: .product(.product7, category: .highlight)) {
    Text("Product 7 Highlight").pbFont(.body, color: .white)
  }

  PBCard(backgroundColor: .product(.product2, category: .highlight)) {
    Text("Product 2 Highlight").pbFont(.body, color: .white)
  }
 }
Highlight Cards

card-highlight

VStack(spacing: Spacing.small) {
  PBCard(highlight: .side(.product(.product6, category: .highlight))) {
    Text("Side Position & Product 6 Highlight Color").pbFont(.body)
  }

  PBCard(highlight: .top(.status(.warning))) {
    Text("Top Position & Warning Color").pbFont(.body)
  }

  PBCard(highlight: .side(.category(.category2))) {
    Text("Side Position & Category 2 Color").pbFont(.body)
  }
 }
Header Cards

card-header

Stack(spacing: Spacing.small) {
  PBCard(padding: Spacing.none) {
    PBCardHeader(color: .category(.category1)) {
      Text("Category 1").pbFont(.body, color: .white).padding(Spacing.small)
    }
      Text("Body").pbFont(.body, color: .text(.default)).padding(Spacing.small)
  }

  PBCard(padding: Spacing.none) {
    PBCardHeader(color: .category(.category3)) {
      Text("Category 3").pbFont(.body, color: .black).padding(Spacing.small)
    }
    Text("Body").pbFont(.body, color: .text(.default)).padding(Spacing.small)
  }

  PBCard(padding: Spacing.none) {
    PBCardHeader(color: .product(.product2, category: .background)) {
      Text("Product 2 Background").pbFont(.body, color: .white).padding(Spacing.small)
    }
      Text("Body").pbFont(.body, color: .text(.default)).padding(Spacing.small)
  }

  PBCard(padding: Spacing.none) {
    PBCardHeader(color: .product(.product6, category: .background)) {
      Text("Product 6 Background").pbFont(.body, color: .white).padding(Spacing.small)
    }
      Text("Body").pbFont(.body, color: .text(.default)).padding(Spacing.small)
  }
}
Padding Size

card-padding

VStack(spacing: Spacing.small) {
  PBCard(padding: Spacing.none) {
    Text("None").pbFont(.body)
  }

  PBCard(padding: Spacing.xxSmall) {
    Text("XX Small").pbFont(.body)
  }

  PBCard(padding: Spacing.xSmall) {
    Text("X Small").pbFont(.body)
  }

  PBCard(padding: Spacing.small) {
    Text("Small").pbFont(.body)
  }

  PBCard(padding: Spacing.medium) {
    Text("Medium").pbFont(.body)
  }

  PBCard(padding: Spacing.large) {
    Text("Large").pbFont(.body)
  }

  PBCard(padding: Spacing.xLarge) {
    Text("X Large").pbFont(.body)
  }
 }
Shadow Size

card-shadow

VStack(spacing: Spacing.small) {
  PBCard(shadow: Shadow.deep) {
    Text("Deep").pbFont(.body)
  }

  PBCard(shadow: Shadow.deeper) {
    Text("Deeper").pbFont(.body)
  }

  PBCard(shadow: Shadow.deepest) {
    Text("Deepest").pbFont(.body)
  }

  PBCard(shadow: Shadow.none) {
    Text("None").pbFont(.body)
  }
 }
Separator Card

card-separator

PBCard(padding: Spacing.none) {
  Text("Header").pbFont(.body).padding(Spacing.small)
  PBSectionSeparator()
  Text(loremIpsum).pbFont(.body).padding(Spacing.small)
  PBSectionSeparator()
  Text("Footer").pbFont(.body).padding(Spacing.small)
 }
No Border

card-no-border

PBCard(border: false) {
  Text(text).pbFont(.body)
 }
Border Radius

card-border-radius

VStack(spacing: Spacing.small) {
  PBCard(borderRadius: BorderRadius.none) {
    Text("None").pbFont(.body)
  }

  PBCard(borderRadius: BorderRadius.xSmall) {
    Text("X Small").pbFont(.body)
  }

  PBCard(borderRadius: BorderRadius.small) {
    Text("Small").pbFont(.body)
  }

  PBCard(borderRadius: BorderRadius.medium) {
    Text("Medium").pbFont(.body)
  }

  PBCard(borderRadius: BorderRadius.large) {
    Text("Large").pbFont(.body)
  }

   PBCard(borderRadius: BorderRadius.xLarge) {
    Text("X Large").pbFont(.body)
  }

   PBCard(borderRadius: BorderRadius.rounded) {
    Text("Rounded").pbFont(.body)
  }
 }
Styles

card-styles

VStack(alignment: .leading, spacing: Spacing.small) {
  PBCard {
    Text("Card Context").pbFont(.body)
  }

  PBCard(style: .selected()) {
    Text("Card Context").pbFont(.body)
  }

  PBCard(style: .error) {
    Text("Card Context").pbFont(.body)
  }
 }

Props

Name Type Description Default Values
Background Color Color Changes background color .card Color
Border Bool Adds border around the Card true true false
Border Radius CGFloat Specifies the roundness of the Card BorderRadius.medium BorderRadius.none BorderRadius.xSmall BorderRadius.small BorderRadius.medium BorderRadius.large BorderRadius.xLarge BorderRadius.rounded
Highlight Highlight Adds a border accent color .none Color
Padding CGFloat Applies padding between text and border Spacing.medium Spacing.none Spacing.xxSmall Spacing.xSmall Spacing.small Spacing.medium Spacing.large Spacing.xLarge
Style PBCardStyle Specifies the color of the border .default .default .selected .error .inline
Shadow Shadow Applies shadow nil Shadow.deep Shadow.deeper Shadow.deepest Shadow.none

UI Samples using Card Kit

Get the full picture. See how this kit is used in our samples.