Device APIAPIs
APIs
The Device API allows the UI Extension to retrieve device information including the device name and ID.
Anchor to deviceapiDeviceApi
Anchor to getDeviceId
getDeviceId
() => Promise<string>
required
The string ID of the device
Anchor to isTablet
isTablet
() => Promise<boolean>
required
Whether the device is a tablet
Anchor to name
name
string
required
The name of the device
Was this section helpful?
Anchor to examplesExamples
Examples of using the Device API.
Anchor to example-retrieve-name-of-the-device.Retrieve name of the device.
Anchor to example-retrieve-the-id-of-the-device.Retrieve the ID of the device.
Anchor to example-check-if-device-is-a-tablet.Check if device is a tablet.
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 />);