sulaf
DocsComponentsComposables
X
Sections
  • Get Started
  • Installation
  • Components
  • Composables
  • Animations
    Soon
Components
  • Autocomplete
    New
  • Show More
    New
  • Meter
    New
  • Contribution Heatmap
    New
  • Typography
    New
  • Code Block
    Soon
  • Code Snippet
    Soon
  • Guided Tour
    Soon
  • Star Rating
    Soon
Composables
  • useGithubProfile
    Beta
  • useIsMac
    New
Animations
Soon

useIsMac

PreviousNext

A composable to detect if the user is on a macOS device.

useIsMac provides a reactive way to determine if the current user is accessing your application from a Mac. This is particularly useful for displaying platform-specific keyboard shortcuts (e.g., Cmd vs Ctrl).

Installation

pnpm dlx sulaf@latest add use-is-mac

Usage

You can use the hook to conditionally render content or apply logic based on the platform. The value is initialized to false and updated on mount to prevent SSR hydration mismatches.

<script setup lang="ts">
import { useIsMac } from '@/composables/useIsMac'

const isMac = useIsMac()
</script>

<template>
  <div>
    <p v-if="isMac">You are using a Mac. Use ⌘ + K to search.</p>
    <p v-else>You are using Windows/Linux. Use Ctrl + K to search.</p>
  </div>
</template>

API Reference

Return Values

ValueTypeDescription
isMacRef<boolean>A reactive reference that is true if the platform is detected as macOS.
useGithubProfileAnimations

On This Page

InstallationUsageAPI ReferenceReturn Values
© 2026 - Built with shadcn-vue . The source code is available on GitHub.