# useIsSubnameAvailable

A React hook for checking if a subname is available for registration.

***

## Usage

```typescript
import { useIsSubnameAvailable } from '@justaname.id/react'

function SubnameAvailabilityComponent() {
  const { isSubnameAvailable, isSubnameAvailableLoading } = useIsSubnameAvailable({
    username: 'alice',
    ensDomain: 'justaname.eth',
    chainId: 1
  })
  
  if (isSubnameAvailableLoading) return <div>Checking availability...</div>
  
  return (
    <div>
      <h3>Subname Availability</h3>
      <p>alice.justaname.eth is {isSubnameAvailable?.isAvailable ? 'available' : 'not available'}</p>
    </div>
  )
}
```

***

## Returns

An object containing:

* `isSubnameAvailable`: Response object with:
  * `isAvailable`: Boolean indicating if the subname is available
* `isSubnameAvailablePending`: Boolean indicating if the query is pending
* `isSubnameAvailableFetching`: Boolean indicating if the query is fetching
* `isSubnameAvailableLoading`: Boolean indicating if the query is loading

## Parameters

Required parameters:

* `username`: The subname to check (e.g., 'alice')

Optional parameters:

* `ensDomain?`: The ENS domain (optional, defaults to provider domain)
* `chainId?`: The chain ID to use (optional, defaults to provider chain ID)
* `enabled?`: Boolean to enable/disable the query (optional, defaults to true)

## Defined in

[packages/@justaname.id/react/src/lib/hooks/subname/useIsSubnameAvailable.ts:28](https://github.com/JustaName-id/JustaName-sdk/blob/dc845c10af242e3ca87d95ef392516ac0bfa8b95/packages/@justaname.id/react/src/lib/hooks/subname/useIsSubnameAvailable.ts#L28)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.justaname.id/sdk-reference/justaname-react-sdk/functions/useissubnameavailable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
