Default Image

Card

Card is a container for text, photos, and actions in the context of a single subject.

import { Card } from '@redshank/native';

Examples

Default

Default card view.

Absolute Card

Absolute header and footer card.

Expandable Card

Expandable header and footer card.

Example Card

Example header and footer card.

With border

With border example card.

APIs

Card

Api props extends from View or Ripple

AttributeTypeAccepted valuesDescriptionDefault
ComponentComponentReact ComponentChange the element baseRipple
backgroundThemeColor stringThemeColorChange background colorborder
borderWidthnumberNumberWhen withBorder prop is true render width of the border in the card-
childrenReactNodeReactNodeAccessory as a child for the component, we suggest passing Header, Content or Footer elements-
expandContentReactNodeReactNodeAccessory for expand when user press the card-
isExpandCardbooleantrue falseActive expand element with press the card!!expandContent
isPressablebooleantrue falseActive the animation effect when to press cardisExpandCard
onlyExpandContentbooleantrue falseIf it is true, it will only show the expandConstant when it is extended.-
onClosefunction(event: any) => voidFunction that is executed after closing the expand content-
ripplePropsRipplePropsobjectProps for ripple wrapper element-
withBorderbooleantrue falseShow borders for the cardfalse
styleobjectStyleProp<ViewStyle>Style for the wrapper card-
Other PropsanyOther propsInteractive props for element-

Api props for Card.Header element

AttributeTypeAccepted valuesDescriptionDefault
ComponentComponentReact ComponentChange the element baseRipple
backgroundThemeColor stringThemeColorChange background colorborder
childrenReactNodeReactNodeAccessory as a child for the component-
isAbsolutebooleantrue falsePosition absolute for headerfalse
leftnumber stringNumber or StringLeft position for absolute variant0
rightnumber stringNumber or StringRight position for absolute variant0
styleobjectStyleProp<ViewStyle>Style for the wrapper card-
topnumber stringNumber or StringTop position for absolute variant0
withBackgroundbooleantrue falseShow background in the headerfalse

Body

Api props for Card.Body element

AttributeTypeAccepted valuesDescriptionDefault
ComponentComponentReact ComponentChange the element baseRipple
childrenReactNodeReactNodeAccessory as a child for the component, we suggest passing Header, Content or Footer elements-
styleobjectStyleProp<ViewStyle>Style for the wrapper card-
withPaddingbooleantrue falseShow padding in the bodyfalse or card in paddingSizes

Api props for Card.Body element

AttributeTypeAccepted valuesDescriptionDefault
ComponentComponentReact ComponentChange the element baseRipple
backgroundThemeColor stringThemeColorChange background colorborder
bottomnumber stringNumber or StringBottom position for absolute variant-
childrenReactNodeReactNodeAccessory as a child for the component-
isAbsolutebooleantrue falsePosition absolute for headerfalse
leftnumber stringNumber or StringLeft position for absolute variant0
rightnumber stringNumber or StringRight position for absolute variant0
styleobjectStyleProp<ViewStyle>Style for the wrapper card-
withBackgroundbooleantrue falseShow background in the headerfalse or card in paddingSizes

Divider

Api props for Card.Divider element

AttributeTypeAccepted valuesDescriptionDefault
backgroundThemeColor stringThemeColorChange background colorborder
heightnumber stringNumber or StringHeight for line divider1
styleobjectStyleProp<ViewStyle>Style for the wrapper card-

Base Properties

type BaseProperties = {
  onBlur?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
  onFocus?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
  onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
  onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
  onPress?: ((event: GestureResponderEvent) => void) | undefined;
  onPressIn?: ((event: GestureResponderEvent) => void) | undefined;
  onPressOut?: ((event: GestureResponderEvent) => void) | undefined;
};

Community:

We're excited to see the community adopt @redshank/native, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!

DiscordGithub

Contributing:

PR's on @redshank/native are always welcome, please see our contribution guidelines to learn how you can contribute to this project.

Copyright © 2023 @redshank.