QUI React

Device Card

The device card is a specialized component intended for SAGA profiler applications.

import {QDeviceCard} from "@qui/react"

Examples

Showcase

EARLY ACCESS
SM8550 chipset
QRD8550
Snapdragon® Reference Design
import {ReactNode, SyntheticEvent} from "react"
import {Check, Info, Settings2, Timer} from "lucide-react"
import {
QBadge,
QDeviceCard,
QIconButton,
QStatus,
useNotification,
} from "@qui/react"
const device = "/images/device-1.png"
export default function Showcase(): ReactNode {
const {notify} = useNotification()
return (
<QDeviceCard
badge={<QBadge color="yellow">EARLY ACCESS</QBadge>}
description="Snapdragon® Reference Design"
deviceChipset="SM8550 chipset"
deviceOs="Android"
footer={
<>
<QStatus
color="brand"
icon={Timer}
kind="icon"
label="32 min remaining"
subtle
/>
<QStatus
color="green"
icon={Check}
kind="icon"
label="Available Now"
subtle
/>
<QStatus
color="brand"
icon={Settings2}
kind="icon"
label="3 configurations"
subtle
/>
</>
}
icon={
<QIconButton
color="primary"
dense
icon={Info}
onClick={(event: SyntheticEvent) => {
notify({
notification: {
color: "informative",
description: `Event type: ${event.type}`,
icon: Info,
label: "Info clicked!",
},
})
}}
size="s"
/>
}
imgAlt="SM8550 chipset"
imgSrc={device}
label="QRD8550"
/>
)
}

Content Customization

The Device Card is modular – most of its input properties accept either a ReactNode or string. The following example features a customized header, label, description, and footer. For a more generic card component, refer to the upcoming Card component.

SM8550 chipset
SA8540P
import {ReactNode} from "react"
import {ChevronRight, Info, X} from "lucide-react"
import {QButton, QDeviceCard, QIconButton, useNotification} from "@qui/react"
const auto = "/images/automotive-1.png"
export default function Customization(): ReactNode {
const {notify} = useNotification()
return (
<QDeviceCard
description={
<span className="text-secondary q-font-metadata-lg">QNX 11</span>
}
footer={
<div className="flex flex-col items-center">
<QButton color="primary" dense endIcon={ChevronRight} size="s">
New Automated Job
</QButton>
<QButton color="primary" dense endIcon={ChevronRight} size="s">
New Interactive Session
</QButton>
</div>
}
header={<img alt="SM8550 chipset" height="128" src={auto} width="128" />}
icon={
<QIconButton
dense
icon={X}
onClick={() => {
notify({
notification: {
color: "informative",
icon: Info,
label: "Info clicked!",
},
})
}}
size="xs"
/>
}
label={<span className="text-primary q-font-heading-xxs">SA8540P</span>}
/>
)
}

Badge Customization

Render a badge by passing the badge property, which accepts either a string or ReactNode. The badge's placement is also configurable via the badgePlacement property.

EARLY ACCESS
SM8550 chipset
QRD8550
Snapdragon® Reference Design
NEW
SM8550 chipset
QRD8550
Snapdragon® Reference Design
import {ReactNode} from "react"
import {deviceCardClasses} from "@qui/base"
import {QBadge, QDeviceCard, QDivider} from "@qui/react"
const device = "/images/device-1.png"
export default function BadgePlacement(): ReactNode {
return (
<div className="grid justify-center">
<div className="flex flex-col gap-6 sm:flex-row">
<QDeviceCard
badge={<QBadge color="yellow">EARLY ACCESS</QBadge>}
description="Snapdragon® Reference Design"
deviceChipset="SM8550 chipset"
deviceOs="Android"
imgAlt="SM8550 chipset"
imgSrc={device}
label="QRD8550"
/>
<QDeviceCard
badge={<QBadge color="green">NEW</QBadge>}
badgePlacement="top-right"
description="Snapdragon® Reference Design"
imgAlt="SM8550 chipset"
imgSrc={device}
label="QRD8550"
metadata={
<div className={deviceCardClasses.metadata}>
<span>SM8550 chipset</span>
<QDivider
orientation="vertical"
spacingAfter="8"
spacingBefore="8"
/>
<span>Android</span>
</div>
}
/>
</div>
</div>
)
}

Full Height

Use the fullHeight property to make the card take the full height of its container. For more complex layouts, consider using a utility like Masonry or Isotope.

EARLY ACCESS
SM8550 chipset
QRD8550
Snapdragon® Reference Design
EARLY ACCESS
SM8550 chipset
QRD8550
Snapdragon® Reference Design
import {ReactNode} from "react"
import {CalendarPlus, Check, Settings2, Timer} from "lucide-react"
import {QBadge, QButton, QDeviceCard, QStatus} from "@qui/react"
const device = "/images/device-1.png"
export default function Stretch(): ReactNode {
return (
<div className="grid justify-center">
<div className="flex flex-col gap-6 sm:flex-row">
<QDeviceCard
badge={<QBadge color="yellow">EARLY ACCESS</QBadge>}
description="Snapdragon® Reference Design"
footer={
<>
<QButton color="primary" dense startIcon={Timer}>
Purchase Minutes
</QButton>
<div className="px-[7px] py-[2px]">
<QStatus
color="neutral"
icon={CalendarPlus}
kind="icon"
label="Book for later"
subtle
/>
</div>
</>
}
fullHeight
imgAlt="SM8550 chipset"
imgSrc={device}
label="QRD8550"
maxLabelWidth="240"
/>
<QDeviceCard
badge={<QBadge color="yellow">EARLY ACCESS</QBadge>}
description="Snapdragon® Reference Design"
footer={
<>
<QStatus
color="brand"
icon={Timer}
kind="icon"
label="32 min remaining"
subtle
/>
<QStatus
color="green"
icon={Check}
kind="icon"
label="Available Now"
subtle
/>
<QStatus
color="brand"
icon={Settings2}
kind="icon"
label="3 configurations"
subtle
/>
</>
}
imgAlt="SM8550 chipset"
imgSrc={device}
label="QRD8550"
maxLabelWidth="240"
/>
</div>
</div>
)
}

Max Label Width

Long labels can be a problem, especially with user-entered content. Use the maxLabelWidth property to prevent the label and description from growing beyond a defined pixel width.

EARLY ACCESS
SM8550 chipset
SM8550_Chipset_Android_Snapdragon
Snapdragon® Reference Design Chipset_Android_SM8550
import {ReactNode} from "react"
import {QBadge, QDeviceCard} from "@qui/react"
const device = "/images/device-1.png"
export default function MaxLabelWidth(): ReactNode {
return (
<div className="grid justify-center">
<QDeviceCard
badge={<QBadge color="yellow">EARLY ACCESS</QBadge>}
description="Snapdragon® Reference Design Chipset_Android_SM8550"
deviceChipset="SM8550 chipset"
deviceOs="Android"
imgAlt="SM8550 chipset"
imgSrc={device}
label="SM8550_Chipset_Android_Snapdragon"
maxLabelWidth="240"
/>
</div>
)
}

API

Props

Name & DescriptionOption(s)Default
Action menu, positioned at the opposite end of the card's label.
ReactNode
Alignment of the card's content.
| 'left'
| 'center'
'left'
The component used for the root node. It can be a React component or element.
| ElementType
| ComponentType
'div'
The background color to apply from the theme. Maps to the q-background- CSS class. This can be overridden using the style prop.
| 1
| 2
| 3
| 4
| '1'
| '2'
| '3'
| '4'
| 'none'
'2'
Content of the badge.
ReactNode
The style variant of the badge.
| 'brand'
| 'red'
| 'orange'
| 'yellow'
| 'kiwi'
| 'green'
| 'teal'
| 'blue'
| 'purple'
| 'fuchsia'
| 'magenta'
| 'neutral'
| 'neutral-dark'
| 'positive'
| 'warning'
| 'negative'
| 'informative'
Placement of the badge.
| 'top-left'
| 'top-right'
"top-left"
The className property of the Element interface gets and sets the value of the class attribute of the specified element.
string
Card description, shown just below the title
ReactNode
Chipset, shown just below the description. If deviceOs is also provided, this will render on the left-hand side. Otherwise, it is centered.
string
OS, shown just below the description. If deviceChipset is also provided, this will render on the right-hand side. Otherwise, it is centered.
string
The elevation (box-shadow) level to apply from the theme. Maps to the q-elevation-#number class.
| 0
| 1
| 2
| 3
| 4
| 5
| '0'
| '1'
| '2'
| '3'
| '4'
| '5'
2
Footer content template. Rendered below the label, description, and metadata container.
ReactNode
When true, the card will take up the full height of its container.
boolean
false
Header content template. Rendered above the label.
ReactNode
lucide-angular icon, positioned in the top-right or top-left corner of the card.
ReactNode
Props passed to the icon of type QIconButton, positioned at the top-right or top-left corner of the card.
Partial<QIconButtonProps>
{}
Color passed to the q-icon-button component when icon is supplied.
| 'inherit'
| 'neutral'
| 'primary'
| 'positive'
| 'warning'
| 'negative'
| 'contrast'
"primary"
String id applied to the card's root container.
string
alt attribute applied to the image element. Does nothing if imgSrc is empty or header is supplied.
string
src attribute applied to the image element. Does nothing if header is supplied.
string
Label element (aka title), the card's primary message.
ReactNode
Supply this property to prevent the label from growing beyond a numeric pixel width. The label will be truncated with an ellipsis if it extends beyond this value.
| string
| number
Metadata section, shown just below the deviceChipset and deviceOs.
ReactNode
The orientation of the card. Sets the card in column- or row-based layout.
| 'horizontal'
| 'vertical'
'vertical'
The padding, spacing, and size of the card's content.
| 'xs'
| 's'
| 'm'
| 'l'
'm'
The style global attribute contains CSS styling declarations to be applied to the element.
CSSProperties
Subtitle (aka secondary label), the message shown relative to the label.
ReactNode
Subtitle placement relative to the label.
| 'above'
| 'below'
'below'
Description
Action menu, positioned at the opposite end of the card's label.
Type
| 'left'
| 'center'
Default
'left'
Description
Alignment of the card's content.
Type
| ElementType
| ComponentType
Default
'div'
Description
The component used for the root node. It can be a React component or element.
Type
| 1
| 2
| 3
| 4
| '1'
| '2'
| '3'
| '4'
| 'none'
Default
'2'
Description
The background color to apply from the theme. Maps to the q-background- CSS class. This can be overridden using the style prop.
Description
Content of the badge.
Type
| 'brand'
| 'red'
| 'orange'
| 'yellow'
| 'kiwi'
| 'green'
| 'teal'
| 'blue'
| 'purple'
| 'fuchsia'
| 'magenta'
| 'neutral'
| 'neutral-dark'
| 'positive'
| 'warning'
| 'negative'
| 'informative'
Description
The style variant of the badge.
Type
| 'top-left'
| 'top-right'
Default
"top-left"
Description
Placement of the badge.
Type
string
Description
The className property of the Element interface gets and sets the value of the class attribute of the specified element.
Description
Card description, shown just below the title
Type
string
Description
Chipset, shown just below the description. If deviceOs is also provided, this will render on the left-hand side. Otherwise, it is centered.
Type
string
Description
OS, shown just below the description. If deviceChipset is also provided, this will render on the right-hand side. Otherwise, it is centered.
Type
| 0
| 1
| 2
| 3
| 4
| 5
| '0'
| '1'
| '2'
| '3'
| '4'
| '5'
Default
2
Description
The elevation (box-shadow) level to apply from the theme. Maps to the q-elevation-#number class.
Description
Footer content template. Rendered below the label, description, and metadata container.
Type
boolean
Default
false
Description
When true, the card will take up the full height of its container.
Description
Header content template. Rendered above the label.
Description
lucide-angular icon, positioned in the top-right or top-left corner of the card.
Type
Partial<QIconButtonProps>
Default
{}
Description
Props passed to the icon of type QIconButton, positioned at the top-right or top-left corner of the card.
Type
| 'inherit'
| 'neutral'
| 'primary'
| 'positive'
| 'warning'
| 'negative'
| 'contrast'
Default
"primary"
Description
Color passed to the q-icon-button component when icon is supplied.
Type
string
Description
String id applied to the card's root container.
Type
string
Description
alt attribute applied to the image element. Does nothing if imgSrc is empty or header is supplied.
Type
string
Description
src attribute applied to the image element. Does nothing if header is supplied.
Description
Label element (aka title), the card's primary message.
Type
| string
| number
Description
Supply this property to prevent the label from growing beyond a numeric pixel width. The label will be truncated with an ellipsis if it extends beyond this value.
Description
Metadata section, shown just below the deviceChipset and deviceOs.
Type
| 'horizontal'
| 'vertical'
Default
'vertical'
Description
The orientation of the card. Sets the card in column- or row-based layout.
Type
| 'xs'
| 's'
| 'm'
| 'l'
Default
'm'
Description
The padding, spacing, and size of the card's content.
Description
The style global attribute contains CSS styling declarations to be applied to the element.
Description
Subtitle (aka secondary label), the message shown relative to the label.
Type
| 'above'
| 'below'
Default
'below'
Description
Subtitle placement relative to the label.