Skip to main content

Selectable Tile

A Tile that is selectable. Tiles can contain logos, icons, or text only.

Example

Live Editor
Result
Loading...

Variants

App Icons

You can add app icons with appIcon (ReactNode) as an external component (mfe-components). Recommended size is small.

import { AppIcon } from '@adjust/mfe-components';

function mySelectableTiles() {
const items = [
{
id: 'a',
name: 'Tiktok',
badge: {
iconName: 'Check',
label: 'Enabled',
color: 'primary'
},
appIcon: <AppIcon appId="com.adjust-demo.cryptoharvest" appName="Finance - Crypto Harvest" size="small" />
},
{
id: 'b',
name: 'Apple Search Ads',
appIcon: <AppIcon appId="com.adjust-demo.pocketbanking" appName="Finance - Pocket Banking" size="small" />,
badge: {
iconName: 'Check',
label: 'Enabled',
color: 'primary'
}
},
{
id: 'c',
name: 'Random App',
appIcon: <AppIcon appId="com.adjust-demo.amazingmarket" appName="Shopping - Amazing Market" size="small" />,
}
]

const [selectedTiles, setSelectedTiles] = useState();

const onSelect = (id) => {
const selectedIDs = [...selectedTiles];
if (!selectedIDs.includes(id)) {
selectedIDs.push(id);
} else {
selectedIDs.splice(selectedIDs.indexOf(id), 1);
}
setSelectedTiles(selectedIDs);
}

return (
<SelectableTile
items={items}
selectedItems={selectedTiles}
spacing={8}
onChange={onSelect}
type="checkbox"
columnSpan={4}
/>
)
}

Selection Mode

Selectable Tiles allow two different modes: checkbox-like multi selection, and radio-like single selection. There must always be at least 2 tiles to be used within a grid.

  • The component allows radio-like single selection by adding type='checkbox' as following example.
Live Editor
Result
Loading...
  • The component allows radio-like single selection by adding type='radio' as following example.
Live Editor
Result
Loading...

Size

There are two sizes available for selectable tiles: small and medium (default).

info

Small tiles can not show a status badge.

Live Editor
Result
Loading...

Tooltip

You can display a tooltip for each SelectableTile item.

To display a tooltip you need to add to your item object tooltipProps property with a content.

The Tooltip position is set to auto by default and can be customized by passing position like below example.

Live Editor
Result
Loading...

Props

SelectableTile

NameTypeDefault
type *
Type of radio or checkbox
"checkbox" | "radio"
selectedItems *
this support single and multiple selected items
string | string[]
items *
Array of SelectableTileItems
SelectableTileItemProps[]
size
A tile size
"small" | "medium"
"medium"
spacing
A number value to set spacing between tiles
number
8
onChange
Onchange function
((id: string) => void)
columnSpan
equal space between tiles
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
4
data-{foo}
Data attributes can be used by testing libraries to retrieve components or assert their existence
string
* - the prop is required.