---
title: "init(_:contentType:source:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/newdocumentbutton/init(_:contenttype:source:)"
---

# init(_:contentType:source:)

Creates and opens new documents, tagging them with a creation source.

## Declaration

```swift
nonisolated init(_ label: Text? = nil, contentType: UTType? = nil, source: DocumentCreationSource)
```

## Parameters

- `label`: A label for the button.
- `contentType`: An optional content type of the document to create. If not provided, the first content type of the first document type listed in the app definition is used.
- `source`: A source for the document creation flow. When a document is created, you can retrieve its source from doc://com.apple.SwiftUI/documentation/SwiftUI/FileDocumentConfiguration or doc://com.apple.SwiftUI/documentation/SwiftUI/URLDocumentConfiguration.

## Discussion

Discussion extension DocumentCreationSource {     static let brainstorming: Self =         DocumentCreationSource(id: "brainstorming") }

DocumentGroupLaunchScene("Meeting Minutes") {     NewDocumentButton(Text("New meeting minutes…"))     NewDocumentButton(         Text("New brainstorming meeting…"),         source: .brainstorming     ) }
