Skip to main content

FloatingActionCard

The FloatingActionCard is an innovative component in our library, blending the functionality of a Floating Action Button (FAB) with the versatility of a Card. This component presents a visually engaging card that "floats" above the content, similar to a FAB, while also providing a structured layout for displaying information or actions. FloatingActionCards are ideal for highlighting important content or key actions within an application, combining accessibility with a sleek design aesthetic. With customizable styles and configurations, our FloatingActionCard component enhances user engagement and navigation efficiency in modern app interfaces.

Usage

Basic usage

import React from 'react';
import {Image, View} from 'react-native';

import {FloatingActionCard} from 'rn-inkpad';

const MyComponent = () => {
return (
<View>
<Image
source={{
uri: 'https://example.com/beach.webp',
}}
style={{width: '100%', height: '100%'}}
/>
<FloatingActionCard title="Maldives hotel" />
</View>
);
};

Props

NameTypeDefaultDescription
backgroundColorRGB | RBGA | HEX#FFFFFFCard background color.
bottomnumber40Separation between bottom and component.
descriptionstringExtra information.
decimalsnumber1Number of decimal places you want to display in the rating.
iconstringIcon that appears next to the rating.
iconColorstring#FFD700Rating icon color.
imageImageSourcePropTypeCard image
ratingnumberRating.
textColorstringText color.
titlestringCard title.
widthDimensionValue90%Card width.
onPress() => voidFunction that is executed when the card is pressed.
Information

All colors will be converted to RGBA with an opacity of 0.9

Usage with props

import React, {useState} from 'react';
import {Image, View} from 'react-native';

import {FloatingActionCard} from 'rn-inkpad';

import Image1 from './assets/beach1';
import Image2 from './assets/beach2';

const MyComponent = () => {
const [secondBackground, setSecondBackground] = useState(false);

const handleChangeImage = () => {
setSecondBackground(!secondBackground);
};

return (
<View>
<Image
source={{
uri: secondBackground ? Image2 : Image1,
}}
style={{width: '100%', height: '100%'}}
/>
<FloatingActionCard
title="Maldives hotel"
icon="star"
description="Lorem ipsum dolor"
image={{
uri: 'https://www.example.com/photo-beautiful-tropical-maldives-resort-hotel.jpg',
}}
rating={5}
onPress={handleChangeImage}
/>
</View>
);
};

Example with props