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
Name | Type | Default |
---|---|---|
type * Type of radio or checkbox |
| — |
selectedItems * this support single and multiple selected items |
| — |
items * Array of SelectableTileItems |
| — |
size A tile size |
| "medium" |
spacing A number value to set spacing between tiles |
| 8 |
onChange Onchange function |
| — |
columnSpan equal space between tiles |
| 4 |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |