# PhoneNumber — SvelteKit UI

Package: sveltekit-ui 1.1.94

Page: https://www.sveltekit-ui.com/components/phone_number

Category: Data & content

Displays a phone number with an optional button to initiate a call. Combines country code and main number, and handles dialing via a clickable button.

Public component import: `PhoneNumber`

Public manager import: `create_phone_number_manager`

## Usage

```svelte
<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { PhoneNumber, create_phone_number_manager } from "sveltekit-ui"

  const manager = create_phone_number_manager({ val: "+12025550123" })
</script>

<PhoneNumber {manager} />
```

## Configuration

### `val`

- type: object or string or null
- default: null
- description: Initial phone number value. If an object, should include `country_code` and `main_number`. If a string, treated as the full phone number.

### `main_number`

- type: string or null
- default: null
- description: The main part of the phone number without the country code.

### `country_code`

- type: string or null
- default: null
- description: The country code part of the phone number (e.g., '+1').

## Methods

### `call_number()`

- description: Initiates a phone call by creating and clicking an `<a>` element with `href='tel:<phone_number>'`.

## Returned state

### `phone_number_to_use`

- type: string or null
- description: The full phone number constructed from `country_code` and `main_number`, or directly from `val` if it's a string.

### `button_manager`

- type: object
- description: Button manager for the call button, configured to initiate a phone call when clicked.
