---
name: ":maybe"
area: "API"
kind: "Target selector"
parent: "up.fragment module"
url: "https://unpoly.com/api/maybe"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.fragment module](https://unpoly.com/api/up.fragment.md)</nav>

# :maybe

Marks a target selector as optional.

If a `:maybe` selector is not found in the current page or the server response, Unpoly will skip rendering the fragment instead of throwing an error.

An optional selector will be omitted from an [`X-Up-Target`](https://unpoly.com/api/X-Up-Target.md) header unless it matches in the current page.

<nav aria-label="Guides">

- [Learn: Targeting fragments](https://unpoly.com/learn/targeting-fragments.md#missing-targets)

</nav>

## Example {#example}

When [updating multiple fragments](https://unpoly.com/learn/targeting-fragments.md#multiple) you may combine required and optional selectors in a single target string.

The link below will update the fragments `.content` (required) and `.details` (optional):

```html
<a href="/card/5" up-target=".content, .details:maybe">...</a>
```

Only the fragment `.content` is required to match. If `.details` is missing in the current page or the server response, Unpoly will only update `.content` without an error.

