Skip to main content

Device API
APIs

The Device API allows the UI Extension to retrieve device information including the device name and ID.

string
required

The name of the device

() => Promise<string>
required

The string ID of the device

() => Promise<boolean>
required

Whether the device is a tablet

Was this section helpful?

Examples of using the Device API.

Was this section helpful?

Retrieve name of the device.

import React, { useState } from 'react';
import {
Tile,
useApi,
reactExtension,
} from '@shopify/ui-extensions-react/point-of-sale';

const SmartGridTile = () => {
const api = useApi<'pos.home.tile.render'>();

return (
<Tile
title='My App'
subtitle={api.device.name}
enabled
/>
);
};

export default reactExtension('pos.home.tile.render', () => <SmartGridTile />);