v6.0.35

use-os

Get user os
Import

Usage

use-os detects user's os. Possible values are: undetermined, macos, ios, windows, android, linux. If os cannot be identified, for example, during server side rendering undetermined will be returned.

Your os is undetermined
import { useOs } from '@asuikit/hooks';
function Demo() {
const os = useOs();
return <>Your os is <b>{os}</b></>;
}

TypeScript

You can import OS union type from @asuikit/hooks:

import type { OS } from '@asuikit/hooks';
// OS type is 'undetermined' | 'macos' | 'ios' | 'windows' | 'android' | 'linux'

Definition

function getOS(options?: {
getValueInEffect: boolean;
}): 'undetermined' | 'macos' | 'ios' | 'windows' | 'android' | 'linux';