├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── release-drafter.yml
└── workflows
│ ├── ci-main.yml
│ ├── ci-pr.yml
│ └── release-drafter.yml
├── .gitignore
├── Blazored.Modal.sln
├── LICENSE
├── README.md
├── docs
├── .gitignore
├── README.md
├── babel.config.js
├── docs
│ ├── configuration
│ │ ├── _category_.json
│ │ ├── background-click.md
│ │ ├── close-button.md
│ │ ├── focus-trap.md
│ │ ├── hide-header.md
│ │ ├── position.md
│ │ └── size.md
│ ├── getting-started.md
│ ├── styling
│ │ ├── _category_.json
│ │ ├── animation.md
│ │ ├── custom-layout.md
│ │ ├── custom-overlay.md
│ │ └── modal-style.md
│ └── usage
│ │ ├── _category_.json
│ │ ├── closing-programmatically.md
│ │ ├── modal-reference.md
│ │ ├── multiple-modals.md
│ │ ├── passing-data.md
│ │ └── returning-data.md
├── docusaurus.config.js
├── package-lock.json
├── package.json
├── sidebars.js
├── src
│ ├── css
│ │ └── custom.css
│ └── pages
│ │ └── markdown-page.md
└── static
│ ├── .nojekyll
│ └── img
│ ├── favicon.ico
│ └── logo.svg
├── samples
├── InteractiveServer
│ ├── Components
│ │ ├── App.razor
│ │ ├── Layout
│ │ │ ├── MainLayout.razor
│ │ │ ├── MainLayout.razor.css
│ │ │ ├── NavMenu.razor
│ │ │ └── NavMenu.razor.css
│ │ ├── Pages
│ │ │ ├── Animation.razor
│ │ │ ├── BackgroundCancel.razor
│ │ │ ├── CustomLayout.razor
│ │ │ ├── CustomOverlay.razor
│ │ │ ├── CustomStyle.razor
│ │ │ ├── Error.razor
│ │ │ ├── HideCloseButton.razor
│ │ │ ├── Home.razor
│ │ │ ├── LongRunningTask.razor
│ │ │ ├── MultipleModals.razor
│ │ │ ├── PassDataToModal.razor
│ │ │ ├── Position.razor
│ │ │ ├── ReturnDataFromModal.razor
│ │ │ └── Size.razor
│ │ ├── Routes.razor
│ │ ├── Shared
│ │ │ ├── Confirm.razor
│ │ │ ├── CustomBootstrapModal.razor
│ │ │ ├── DisplayMessage.razor
│ │ │ ├── FullContentPage.razor
│ │ │ ├── Loading.razor
│ │ │ ├── MessageForm.razor
│ │ │ ├── TestClass.cs
│ │ │ ├── YesNoPrompt.razor
│ │ │ └── YesNoPromptAnimation.razor
│ │ └── _Imports.razor
│ ├── InteractiveServer.csproj
│ ├── Program.cs
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ └── wwwroot
│ │ ├── app.css
│ │ ├── bootstrap
│ │ ├── bootstrap.min.css
│ │ └── bootstrap.min.css.map
│ │ └── favicon.png
└── InteractiveWebAssembly
│ ├── App.razor
│ ├── InteractiveWebAssembly.csproj
│ ├── Layout
│ ├── MainLayout.razor
│ ├── MainLayout.razor.css
│ ├── NavMenu.razor
│ └── NavMenu.razor.css
│ ├── Pages
│ ├── Animation.razor
│ ├── BackGroundCancel.razor
│ ├── CustomLayout.razor
│ ├── CustomOverlay.razor
│ ├── CustomStyle.razor
│ ├── HideCloseButton.razor
│ ├── Home.razor
│ ├── LongRunningTask.razor
│ ├── MultipleModals.razor
│ ├── NavigateAfterModal.razor
│ ├── PassDataToModal.razor
│ ├── Position.razor
│ ├── ReturnDataFromModal.razor
│ └── Size.razor
│ ├── Program.cs
│ ├── Shared
│ ├── CodeBlock.razor
│ ├── CodeBlock.razor.js
│ ├── Confirm.razor
│ ├── CustomBootstrapModal.razor
│ ├── DisplayMessage.razor
│ ├── FullContentPage.razor
│ ├── Loading.razor
│ ├── MessageForm.razor
│ ├── YesNoPrompt.razor
│ └── YesNoPromptAnimation.razor
│ ├── _Imports.razor
│ └── wwwroot
│ ├── .nojekyll
│ ├── 404.html
│ ├── css
│ ├── app.css
│ └── bootstrap
│ │ ├── bootstrap.min.css
│ │ └── bootstrap.min.css.map
│ ├── favicon.png
│ ├── icon-192.png
│ ├── index.html
│ └── js
│ ├── cshtml-razor.min.js
│ ├── decode.js
│ └── highlight.min.js
├── screenshot.png
├── src
└── Blazored.Modal
│ ├── Blazored.Modal.csproj
│ ├── BlazoredModal.razor
│ ├── BlazoredModal.razor.js
│ ├── BlazoredModalInstance.razor
│ ├── BlazoredModalInstance.razor.cs
│ ├── BlazoredModalInstance.razor.css
│ ├── CascadingBlazoredModal.razor
│ ├── Configuration
│ ├── IModalReference.cs
│ ├── ModalAnimationType.cs
│ ├── ModalOptions.cs
│ ├── ModalParameters.cs
│ ├── ModalPosition.cs
│ ├── ModalReference.cs
│ └── ModalSize.cs
│ ├── FocusTrap.razor
│ ├── ServiceCollectionExtensions.cs
│ ├── Services
│ ├── IModalService.cs
│ ├── ModalResult.cs
│ └── ModalService.cs
│ ├── _Imports.razor
│ └── icon.png
└── tests
└── Blazored.Modal.Tests
├── Assets
├── MockNavigationManager.cs
└── TestComponent.razor
├── Blazored.Modal.Tests.csproj
├── DisplayTests.cs
├── ModalOptionsTests.cs
└── _Imports.razor
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [chrissainty]
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: "[Bug]"
5 | labels: Bug, Triage
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Hosting Model (is this issue happening with a certain hosting model?):**
27 | - Blazor Server
28 | - Blazor WebAssembly
29 | - etc...
30 |
31 | **Additional context**
32 | Add any other context about the problem here.
33 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: "[Feature Request]"
5 | labels: Feature Request, Triage
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/release-drafter.yml:
--------------------------------------------------------------------------------
1 | name-template: 'v$NEXT_PATCH_VERSION'
2 | tag-template: 'v$NEXT_PATCH_VERSION'
3 | template: |
4 | # What's Changed
5 |
6 | $CHANGES
7 | categories:
8 | - title: '🚀 Features'
9 | labels:
10 | - 'Feature'
11 | - title: '🐛 Bug Fixes'
12 | labels:
13 | - 'Bug'
14 | - title: '🧰 Maintenance'
15 | label: 'Maintenance'
16 | - title: '📖 Documentation'
17 | label: 'Docs'
18 | change-template: '- (#$NUMBER) $TITLE - Thanks to @$AUTHOR '
--------------------------------------------------------------------------------
/.github/workflows/ci-main.yml:
--------------------------------------------------------------------------------
1 | name: Build & Test Main
2 |
3 | on:
4 | push:
5 | branches: [main]
6 | release:
7 | types: [published]
8 |
9 | env:
10 | NETCORE_VERSION: "8.0.x"
11 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
12 | DOTNET_CLI_TELEMETRY_OPTOUT: true
13 | PROJECT_NAME: Modal
14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 | NUGET_FEED: https://api.nuget.org/v3/index.json
16 | NUGET_KEY: ${{ secrets.NUGET_KEY }}
17 |
18 | jobs:
19 | build:
20 | name: Build, test and pack
21 | runs-on: ubuntu-latest
22 | steps:
23 | - name: Checkout
24 | uses: actions/checkout@v2
25 |
26 | - name: Setup .NET Core ${{ env.NETCORE_VERSION }}
27 | uses: actions/setup-dotnet@v1
28 | with:
29 | dotnet-version: ${{ env.NETCORE_VERSION }}
30 | env:
31 | NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
32 |
33 | - name: Restore
34 | run: dotnet restore
35 |
36 | - name: Build Modal
37 | run: dotnet build -c Release --no-restore src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.csproj
38 |
39 | - name: Test
40 | run: dotnet test -c Release --no-restore --verbosity normal
41 |
42 | deploy:
43 | needs: build
44 | if: github.event_name == 'release'
45 | runs-on: ubuntu-latest
46 | steps:
47 | - uses: actions/checkout@v2
48 |
49 | - name: Setup .NET Core
50 | uses: actions/setup-dotnet@v1
51 | with:
52 | dotnet-version: ${{ env.NETCORE_VERSION }}
53 |
54 | - name: Create Release NuGet package
55 | run: |
56 | arrTag=(${GITHUB_REF//\// })
57 | VERSION="${arrTag[2]}"
58 | echo Version: $VERSION
59 | VERSION="${VERSION//v}"
60 | echo Clean Version: $VERSION
61 | dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.csproj
62 |
63 | - name: Push to NuGet Feed
64 | run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --api-key $NUGET_KEY --skip-duplicate
65 |
66 | docs:
67 | name: Publish docs
68 | runs-on: ubuntu-latest
69 | defaults:
70 | run:
71 | working-directory: ./docs
72 | steps:
73 | - uses: actions/checkout@v2
74 | - uses: actions/setup-node@v3
75 | with:
76 | node-version: 18
77 | cache: npm
78 | cache-dependency-path: './docs/package-lock.json'
79 |
80 | - name: Install dependencies
81 | run: npm ci
82 | - name: Build website
83 | run: npm run build
84 |
85 | # Popular action to deploy to GitHub Pages:
86 | # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
87 | - name: Deploy to GitHub Pages
88 | uses: peaceiris/actions-gh-pages@v3
89 | with:
90 | github_token: ${{ secrets.GITHUB_TOKEN }}
91 | # Build output to publish to the `gh-pages` branch:
92 | publish_dir: ./docs/build
93 | # The following lines assign commit authorship to the official
94 | # GH-Actions bot for deploys to `gh-pages` branch:
95 | # https://github.com/actions/checkout/issues/13#issuecomment-724415212
96 | # The GH actions bot is used by default if you didn't specify the two fields.
97 | # You can swap them out with your own user credentials.
98 | user_name: github-actions[bot]
99 | user_email: 41898282+github-actions[bot]@users.noreply.github.com
100 |
--------------------------------------------------------------------------------
/.github/workflows/ci-pr.yml:
--------------------------------------------------------------------------------
1 | name: Build & Test PR
2 |
3 | on:
4 | pull_request:
5 | branches: [ main ]
6 |
7 | env:
8 | PROJECT_NAME: Blazored.Modal
9 | NETCORE_VERSION: '8.0.x'
10 |
11 | jobs:
12 | build:
13 | name: Build and test
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v2
17 |
18 | - name: Setting up .NET Core SDK ${{ env.NETCORE_VERSION }}...
19 | uses: actions/setup-dotnet@v1
20 | with:
21 | dotnet-version: ${{ env.NETCORE_VERSION }}
22 |
23 | - name: Restoring packages...
24 | run: dotnet restore
25 |
26 | - name: Building project...
27 | run: dotnet build --configuration Release --no-restore src/$PROJECT_NAME/$PROJECT_NAME.csproj
28 |
29 | - name: Testing...
30 | run: dotnet test --no-restore --verbosity normal
31 |
32 | docs-test-deploy:
33 | name: Docs test deployment
34 | runs-on: ubuntu-latest
35 | defaults:
36 | run:
37 | working-directory: ./docs
38 | steps:
39 | - uses: actions/checkout@v2
40 | - uses: actions/setup-node@v3
41 | with:
42 | node-version: 18
43 | cache: npm
44 | cache-dependency-path: './docs/package-lock.json'
45 |
46 | - name: Install dependencies
47 | run: npm ci
48 | - name: Test build website
49 | run: npm run build
--------------------------------------------------------------------------------
/.github/workflows/release-drafter.yml:
--------------------------------------------------------------------------------
1 | name: Release Drafter
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | update_release_draft:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: release-drafter/release-drafter@v5
13 | env:
14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # Custom rules
7 | src/Blazored.Modal/wwwroot/*.js
8 | src/Blazored.Modal/wwwroot/*.map
9 | .DS_Store
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.userosscache
15 | *.sln.docstates
16 |
17 | # User-specific files (MonoDevelop/Xamarin Studio)
18 | *.userprefs
19 |
20 | # Build results
21 | [Dd]ebug/
22 | [Dd]ebugPublic/
23 | [Rr]elease/
24 | [Rr]eleases/
25 | x64/
26 | x86/
27 | bld/
28 | [Bb]in/
29 | [Oo]bj/
30 | [Ll]og/
31 |
32 | # Visual Studio 2015/2017 cache/options directory
33 | .vs/
34 | # Uncomment if you have tasks that create the project's static files in wwwroot
35 | #wwwroot/
36 |
37 | # Visual Studio 2017 auto generated files
38 | Generated\ Files/
39 |
40 | # MSTest test Results
41 | [Tt]est[Rr]esult*/
42 | [Bb]uild[Ll]og.*
43 |
44 | # NUNIT
45 | *.VisualState.xml
46 | TestResult.xml
47 |
48 | # Build Results of an ATL Project
49 | [Dd]ebugPS/
50 | [Rr]eleasePS/
51 | dlldata.c
52 |
53 | # Benchmark Results
54 | BenchmarkDotNet.Artifacts/
55 |
56 | # .NET Core
57 | project.lock.json
58 | project.fragment.lock.json
59 | artifacts/
60 | **/Properties/launchSettings.json
61 |
62 | # StyleCop
63 | StyleCopReport.xml
64 |
65 | # Files built by Visual Studio
66 | *_i.c
67 | *_p.c
68 | *_i.h
69 | *.ilk
70 | *.meta
71 | *.obj
72 | *.iobj
73 | *.pch
74 | *.pdb
75 | *.ipdb
76 | *.pgc
77 | *.pgd
78 | *.rsp
79 | *.sbr
80 | *.tlb
81 | *.tli
82 | *.tlh
83 | *.tmp
84 | *.tmp_proj
85 | *.log
86 | *.vspscc
87 | *.vssscc
88 | .builds
89 | *.pidb
90 | *.svclog
91 | *.scc
92 |
93 | # Chutzpah Test files
94 | _Chutzpah*
95 |
96 | # Visual C++ cache files
97 | ipch/
98 | *.aps
99 | *.ncb
100 | *.opendb
101 | *.opensdf
102 | *.sdf
103 | *.cachefile
104 | *.VC.db
105 | *.VC.VC.opendb
106 |
107 | # Visual Studio profiler
108 | *.psess
109 | *.vsp
110 | *.vspx
111 | *.sap
112 |
113 | # Visual Studio Trace Files
114 | *.e2e
115 |
116 | # TFS 2012 Local Workspace
117 | $tf/
118 |
119 | # Guidance Automation Toolkit
120 | *.gpState
121 |
122 | # ReSharper is a .NET coding add-in
123 | _ReSharper*/
124 | *.[Rr]e[Ss]harper
125 | *.DotSettings.user
126 |
127 | # JustCode is a .NET coding add-in
128 | .JustCode
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Visual Studio code coverage results
141 | *.coverage
142 | *.coveragexml
143 |
144 | # NCrunch
145 | _NCrunch_*
146 | .*crunch*.local.xml
147 | nCrunchTemp_*
148 |
149 | # MightyMoose
150 | *.mm.*
151 | AutoTest.Net/
152 |
153 | # Web workbench (sass)
154 | .sass-cache/
155 |
156 | # Installshield output folder
157 | [Ee]xpress/
158 |
159 | # DocProject is a documentation generator add-in
160 | DocProject/buildhelp/
161 | DocProject/Help/*.HxT
162 | DocProject/Help/*.HxC
163 | DocProject/Help/*.hhc
164 | DocProject/Help/*.hhk
165 | DocProject/Help/*.hhp
166 | DocProject/Help/Html2
167 | DocProject/Help/html
168 |
169 | # Click-Once directory
170 | publish/
171 |
172 | # Publish Web Output
173 | *.[Pp]ublish.xml
174 | *.azurePubxml
175 | # Note: Comment the next line if you want to checkin your web deploy settings,
176 | # but database connection strings (with potential passwords) will be unencrypted
177 | *.pubxml
178 | *.publishproj
179 |
180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
181 | # checkin your Azure Web App publish settings, but sensitive information contained
182 | # in these scripts will be unencrypted
183 | PublishScripts/
184 |
185 | # NuGet Packages
186 | *.nupkg
187 | # The packages folder can be ignored because of Package Restore
188 | **/[Pp]ackages/*
189 | # except build/, which is used as an MSBuild target.
190 | !**/[Pp]ackages/build/
191 | # Uncomment if necessary however generally it will be regenerated when needed
192 | #!**/[Pp]ackages/repositories.config
193 | # NuGet v3's project.json files produces more ignorable files
194 | *.nuget.props
195 | *.nuget.targets
196 |
197 | # Microsoft Azure Build Output
198 | csx/
199 | *.build.csdef
200 |
201 | # Microsoft Azure Emulator
202 | ecf/
203 | rcf/
204 |
205 | # Windows Store app package directories and files
206 | AppPackages/
207 | BundleArtifacts/
208 | Package.StoreAssociation.xml
209 | _pkginfo.txt
210 | *.appx
211 |
212 | # Visual Studio cache files
213 | # files ending in .cache can be ignored
214 | *.[Cc]ache
215 | # but keep track of directories ending in .cache
216 | !*.[Cc]ache/
217 |
218 | # Others
219 | ClientBin/
220 | ~$*
221 | *~
222 | *.dbmdl
223 | *.dbproj.schemaview
224 | *.jfm
225 | *.pfx
226 | *.publishsettings
227 | orleans.codegen.cs
228 |
229 | # Including strong name files can present a security risk
230 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
231 | #*.snk
232 |
233 | # Since there are multiple workflows, uncomment next line to ignore bower_components
234 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
235 | #bower_components/
236 |
237 | # RIA/Silverlight projects
238 | Generated_Code/
239 |
240 | # Backup & report files from converting an old project file
241 | # to a newer Visual Studio version. Backup files are not needed,
242 | # because we have git ;-)
243 | _UpgradeReport_Files/
244 | Backup*/
245 | UpgradeLog*.XML
246 | UpgradeLog*.htm
247 | ServiceFabricBackup/
248 | *.rptproj.bak
249 |
250 | # SQL Server files
251 | *.mdf
252 | *.ldf
253 | *.ndf
254 |
255 | # Business Intelligence projects
256 | *.rdl.data
257 | *.bim.layout
258 | *.bim_*.settings
259 | *.rptproj.rsuser
260 |
261 | # Microsoft Fakes
262 | FakesAssemblies/
263 |
264 | # GhostDoc plugin setting file
265 | *.GhostDoc.xml
266 |
267 | # Node.js Tools for Visual Studio
268 | .ntvs_analysis.dat
269 | node_modules/
270 |
271 | # Visual Studio 6 build log
272 | *.plg
273 |
274 | # Visual Studio 6 workspace options file
275 | *.opt
276 |
277 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
278 | *.vbw
279 |
280 | # Visual Studio LightSwitch build output
281 | **/*.HTMLClient/GeneratedArtifacts
282 | **/*.DesktopClient/GeneratedArtifacts
283 | **/*.DesktopClient/ModelManifest.xml
284 | **/*.Server/GeneratedArtifacts
285 | **/*.Server/ModelManifest.xml
286 | _Pvt_Extensions
287 |
288 | # Paket dependency manager
289 | .paket/paket.exe
290 | paket-files/
291 |
292 | # FAKE - F# Make
293 | .fake/
294 |
295 | # JetBrains Rider
296 | .idea/
297 | *.sln.iml
298 |
299 | # CodeRush
300 | .cr/
301 |
302 | # Python Tools for Visual Studio (PTVS)
303 | __pycache__/
304 | *.pyc
305 |
306 | # Cake - Uncomment if you are using it
307 | # tools/**
308 | # !tools/packages.config
309 |
310 | # Tabs Studio
311 | *.tss
312 |
313 | # Telerik's JustMock configuration file
314 | *.jmconfig
315 |
316 | # BizTalk build output
317 | *.btp.cs
318 | *.btm.cs
319 | *.odx.cs
320 | *.xsd.cs
321 |
322 | # OpenCover UI analysis results
323 | OpenCover/
324 |
325 | # Azure Stream Analytics local run output
326 | ASALocalRun/
327 |
328 | # MSBuild Binary and Structured Log
329 | *.binlog
330 |
331 | # NVidia Nsight GPU debugger configuration file
332 | *.nvuser
333 |
334 | # MFractors (Xamarin productivity tool) working folder
335 | .mfractor/
336 |
--------------------------------------------------------------------------------
/Blazored.Modal.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28531.58
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazored.Modal", "src\Blazored.Modal\Blazored.Modal.csproj", "{997CB0B4-2B3F-4625-9259-A560CD82AC8C}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{AC842EAA-F630-4597-A0FC-6758FE9F6268}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E8AD9151-AB7E-4531-A1DF-8952B1D5580D}"
11 | ProjectSection(SolutionItems) = preProject
12 | README.md = README.md
13 | .gitignore = .gitignore
14 | .github\workflows\ci-main.yml = .github\workflows\ci-main.yml
15 | .github\workflows\ci-pr.yml = .github\workflows\ci-pr.yml
16 | EndProjectSection
17 | EndProject
18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{DF45C5D5-16E0-47FC-A764-08ED8AF713E2}"
19 | EndProject
20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazored.Modal.Tests", "tests\Blazored.Modal.Tests\Blazored.Modal.Tests.csproj", "{14B17729-C172-4F0C-90FF-65479AF6408F}"
21 | EndProject
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InteractiveWebAssembly", "samples\InteractiveWebAssembly\InteractiveWebAssembly.csproj", "{E2C5884F-4FE4-4A5B-B9A3-046E9C546454}"
23 | EndProject
24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InteractiveServer", "samples\InteractiveServer\InteractiveServer.csproj", "{393CCD7E-66D0-4BB5-A087-425F1B643EAF}"
25 | EndProject
26 | Global
27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
28 | Debug|Any CPU = Debug|Any CPU
29 | Debug|x64 = Debug|x64
30 | Debug|x86 = Debug|x86
31 | Release|Any CPU = Release|Any CPU
32 | Release|x64 = Release|x64
33 | Release|x86 = Release|x86
34 | EndGlobalSection
35 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
36 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Debug|x64.ActiveCfg = Debug|Any CPU
39 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Debug|x64.Build.0 = Debug|Any CPU
40 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Debug|x86.ActiveCfg = Debug|Any CPU
41 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Debug|x86.Build.0 = Debug|Any CPU
42 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Release|x64.ActiveCfg = Release|Any CPU
45 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Release|x64.Build.0 = Release|Any CPU
46 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Release|x86.ActiveCfg = Release|Any CPU
47 | {997CB0B4-2B3F-4625-9259-A560CD82AC8C}.Release|x86.Build.0 = Release|Any CPU
48 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Debug|x64.ActiveCfg = Debug|Any CPU
51 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Debug|x64.Build.0 = Debug|Any CPU
52 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Debug|x86.ActiveCfg = Debug|Any CPU
53 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Debug|x86.Build.0 = Debug|Any CPU
54 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Release|Any CPU.Build.0 = Release|Any CPU
56 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Release|x64.ActiveCfg = Release|Any CPU
57 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Release|x64.Build.0 = Release|Any CPU
58 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Release|x86.ActiveCfg = Release|Any CPU
59 | {14B17729-C172-4F0C-90FF-65479AF6408F}.Release|x86.Build.0 = Release|Any CPU
60 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Debug|Any CPU.Build.0 = Debug|Any CPU
62 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Debug|x64.ActiveCfg = Debug|Any CPU
63 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Debug|x64.Build.0 = Debug|Any CPU
64 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Debug|x86.ActiveCfg = Debug|Any CPU
65 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Debug|x86.Build.0 = Debug|Any CPU
66 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Release|Any CPU.ActiveCfg = Release|Any CPU
67 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Release|Any CPU.Build.0 = Release|Any CPU
68 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Release|x64.ActiveCfg = Release|Any CPU
69 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Release|x64.Build.0 = Release|Any CPU
70 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Release|x86.ActiveCfg = Release|Any CPU
71 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454}.Release|x86.Build.0 = Release|Any CPU
72 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
74 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Debug|x64.ActiveCfg = Debug|Any CPU
75 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Debug|x64.Build.0 = Debug|Any CPU
76 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Debug|x86.ActiveCfg = Debug|Any CPU
77 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Debug|x86.Build.0 = Debug|Any CPU
78 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
79 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Release|Any CPU.Build.0 = Release|Any CPU
80 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Release|x64.ActiveCfg = Release|Any CPU
81 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Release|x64.Build.0 = Release|Any CPU
82 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Release|x86.ActiveCfg = Release|Any CPU
83 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF}.Release|x86.Build.0 = Release|Any CPU
84 | EndGlobalSection
85 | GlobalSection(SolutionProperties) = preSolution
86 | HideSolutionNode = FALSE
87 | EndGlobalSection
88 | GlobalSection(NestedProjects) = preSolution
89 | {14B17729-C172-4F0C-90FF-65479AF6408F} = {DF45C5D5-16E0-47FC-A764-08ED8AF713E2}
90 | {E2C5884F-4FE4-4A5B-B9A3-046E9C546454} = {AC842EAA-F630-4597-A0FC-6758FE9F6268}
91 | {393CCD7E-66D0-4BB5-A087-425F1B643EAF} = {AC842EAA-F630-4597-A0FC-6758FE9F6268}
92 | EndGlobalSection
93 | GlobalSection(ExtensibilityGlobals) = postSolution
94 | SolutionGuid = {FB2D90F4-21CF-4118-82E7-479E89C15FB3}
95 | EndGlobalSection
96 | EndGlobal
97 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Blazored
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blazored Modal
2 |
3 | A powerful and customizable modal implementation for [Blazor](https://blazor.net) applications.
4 |
5 | [](https://www.nuget.org/packages/Blazored.Modal/)
6 | [](https://www.nuget.org/packages/Blazored.Modal/)
7 | 
8 |
9 | 
10 |
11 | ## Documentation
12 | For information on getting Blazored Modal setup in your application, as well as the many customisation options, please checkout our [docs](https://blazored.github.io/Modal/).
13 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | /node_modules
3 |
4 | # Production
5 | /build
6 |
7 | # Generated files
8 | .docusaurus
9 | .cache-loader
10 |
11 | # Misc
12 | .DS_Store
13 | .env.local
14 | .env.development.local
15 | .env.test.local
16 | .env.production.local
17 |
18 | npm-debug.log*
19 | yarn-debug.log*
20 | yarn-error.log*
21 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Website
2 |
3 | This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4 |
5 | ### Installation
6 |
7 | ```
8 | $ yarn
9 | ```
10 |
11 | ### Local Development
12 |
13 | ```
14 | $ yarn start
15 | ```
16 |
17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18 |
19 | ### Build
20 |
21 | ```
22 | $ yarn build
23 | ```
24 |
25 | This command generates static content into the `build` directory and can be served using any static contents hosting service.
26 |
27 | ### Deployment
28 |
29 | Using SSH:
30 |
31 | ```
32 | $ USE_SSH=true yarn deploy
33 | ```
34 |
35 | Not using SSH:
36 |
37 | ```
38 | $ GIT_USER= yarn deploy
39 | ```
40 |
41 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
42 |
--------------------------------------------------------------------------------
/docs/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3 | };
4 |
--------------------------------------------------------------------------------
/docs/docs/configuration/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Configuration",
3 | "position": 2,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "The configuration options available for Blazored Modal."
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/configuration/background-click.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 5
3 | ---
4 |
5 | # Background Click
6 | By default, a modal is cancelled if the user clicks anywhere outside the modal. This behavior can be disabled by setting `DisableBackgroundCancel` option to `true`.
7 |
8 | #### Configuring for all modals
9 | ```razor
10 |
11 | ```
12 |
13 | #### Configuring for a single modal
14 |
15 | ```csharp
16 | var options = new ModalOptions()
17 | {
18 | DisableBackgroundCancel = true
19 | };
20 |
21 | Modal.Show("Are you sure?", options);
22 | ```
--------------------------------------------------------------------------------
/docs/docs/configuration/close-button.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 3
3 | ---
4 |
5 | # Close Button
6 |
7 | By default, modals will display a close button in the top right corner. However, if you prefer, you can remove the close button using the `HideCloseButton` option.
8 |
9 | :::info
10 |
11 | If you're hiding the header using the [`HideHeader`](./hide-header) option, the `HideCloseButton` option will have no effect.
12 |
13 | :::
14 |
15 | ### Configuring for all modals
16 | ```razor
17 |
18 | ```
19 |
20 | ### Configuring for a single modal
21 |
22 | ```csharp
23 | var options = new ModalOptions()
24 | {
25 | HideCloseButton = true
26 | };
27 |
28 | Modal.Show("Are you sure?", options);
29 | ```
--------------------------------------------------------------------------------
/docs/docs/configuration/focus-trap.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 6
3 | ---
4 |
5 | # Focus Trap
6 | Blazored Modal comes with a built-in focus trap. Focus traps are an important feature for accessability as they stop focus dropping behind the modal when pressing the *tab* key.
7 |
8 | If you do wish to disable this feature, you can do so using the `ActivateFocusTrap` option and set it to `false`.
9 |
10 | #### Configuring for all modals
11 | ```razor
12 |
13 | ```
14 |
15 | #### Configuring for a single modal
16 |
17 | ```csharp
18 | var options = new ModalOptions()
19 | {
20 | ActivateFocusTrap = false
21 | };
22 |
23 | Modal.Show("Are you sure?", options);
24 | ```
--------------------------------------------------------------------------------
/docs/docs/configuration/hide-header.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | ---
4 |
5 | # Hide Header
6 |
7 | When displaying a modal, a header is rendered showing the title of the modal and the close button. However, if you're planning to render your own header as part of the component being displayed, or you just don't want a header, you can turn it off.
8 |
9 | ### Configuring for all modals
10 | ```razor
11 |
12 | ```
13 |
14 | ### Configuring for a single modal
15 |
16 | ```csharp
17 | var options = new ModalOptions()
18 | {
19 | HideHeader = true
20 | };
21 |
22 | Modal.Show("Are you sure?", options);
23 | ```
--------------------------------------------------------------------------------
/docs/docs/configuration/position.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # Position
6 |
7 | Modals are shown in the center of the screen near the top of the viewport. This can be customised via the `Position` option using the `ModalPosition` enum. The options available are:
8 |
9 | - Top Left
10 | - Top Right
11 | - Top Center
12 | - Middle
13 | - Bottom Left
14 | - Bottom Right
15 | - Custom
16 |
17 | ### Using a predefined position
18 | To configure Blazored Modal to use a predefined position, see the code examples below.
19 |
20 |
21 | #### Configuring for all modals
22 | ```razor
23 |
24 | ```
25 |
26 | #### Configuring for a single modal
27 |
28 | ```csharp
29 | var options = new ModalOptions()
30 | {
31 | Position = ModalPosition.TopLeft
32 | };
33 |
34 | Modal.Show("Are you sure?", options);
35 | ```
36 |
37 | ### Using a custom position
38 | When using the `Custom` position setting, you will need to provide a CSS class, via the `PositionCustomClass` option, that sets the modal position.
39 |
40 | #### Configuring for all modals
41 |
42 | ```razor
43 |
44 | ```
45 |
46 | #### Configuring for a single modal
47 |
48 | ```csharp
49 | var options = new ModalOptions()
50 | {
51 | Position = ModalPosition.Custom,
52 | PositionCustomClass = "custom-modal-position"
53 | };
54 |
55 | Modal.Show("Are you sure?", options);
56 | ```
--------------------------------------------------------------------------------
/docs/docs/configuration/size.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 1
3 | ---
4 |
5 | # Size
6 |
7 | The width of a modal can be configured using the `Size` option. Blazored Modal has a range of built-in sizes as well as the ability to define a custom size.
8 |
9 | - Automatic (Size is determined by the content)
10 | - Small (300px)
11 | - Medium (500px)
12 | - Large (800px)
13 | - Extra Large (1140px)
14 | - Custom
15 |
16 | If no `Size` option is specified the default size is `Medium`.
17 |
18 | ### Using a predefined size
19 | To configure Blazored Modal to use a predefined size, see the code examples below.
20 |
21 | #### Configuring for all modals
22 | To set the `Size` for all modals in your application, you can use the `Size` parameter on the `CascadingBlazoredModal` component.
23 |
24 | ```razor
25 |
26 | ```
27 |
28 | #### Configuring for a single modal
29 | To set the `Size` for a single modal, use the `ModalOptions` type and pass it into the `Show` method.
30 |
31 | ```csharp
32 | var options = new ModalOptions()
33 | {
34 | Size = ModalSize.Large
35 | };
36 |
37 | Modal.Show("Are you sure?", options);
38 | ```
39 |
40 | ### Using a custom size
41 | If you don't want to use one of the default sizes provided out-of-the-box, you can set the `Size` to `ModalSize.Custom`. When using the `Custom` option, you will need to provide a CSS class which sets the size of the modal. Do this using the `SizeCustomClass` option.
42 |
43 | #### Configuring for all modals
44 | To set a custom size for all modals in your application, use the `CascadingBlazoredModal` component.
45 |
46 | ```razor
47 |
48 | ```
49 |
50 | #### Configuring for a single modal
51 | To set a custom size for a single modal, use the `ModalOptions` type and pass it into the `Show` method.
52 |
53 | ```csharp
54 | var options = new ModalOptions()
55 | {
56 | Size = ModalSize.Custom,
57 | SizeCustomClass = "custom-modal"
58 | };
59 |
60 | Modal.Show("Are you sure?", options);
61 | ```
--------------------------------------------------------------------------------
/docs/docs/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | slug: /
3 | title: Getting Started
4 | sidebar_position: 1
5 | ---
6 |
7 | # Blazored Modal Docs
8 |
9 | [](https://www.nuget.org/packages/Blazored.Modal/)
10 | [](https://github.com/Blazored/Modal/issues)
11 | 
12 |
13 | Blazored Modal is a powerful and customizable modal implementation for [Blazor applications](https://blazor.net).
14 |
15 | ## Getting Started
16 |
17 | The first step is to install the Blazored.Modal NuGet package into your project. You can install the package via the nuget package manager, just search for *Blazored.Modal*. You can also install via powershell using the following command.
18 |
19 | ```powershell
20 | Install-Package Blazored.Modal
21 | ```
22 |
23 | Or via the dotnet CLI.
24 |
25 | ```bash
26 | dotnet add package Blazored.Modal
27 | ```
28 |
29 | ### Register Services
30 |
31 | Blazored Modal uses a service to coordinate modals. To register this service you need to add the following using statement and call to `AddBlazoredModal` in your applications `Program.cs` file.
32 |
33 | ```csharp
34 | using Blazored.Modal;
35 | ```
36 |
37 | ```csharp
38 | builder.Services.AddBlazoredModal();
39 | ```
40 |
41 | :::info
42 |
43 | The above code assumes the use of top level statements. If your application is not using them, please add the call to `AddBlazoredModal` where you're registering services for your app.
44 |
45 | :::
46 |
47 | ### Add Imports
48 |
49 | To avoid having to add using statements for Blazored Modal to lots of components in your project, it's recommended that you add the following to your root *_Imports.razor* file. This will make the following usings available to all component in that project.
50 |
51 | ```razor
52 | @using Blazored.Modal
53 | @using Blazored.Modal.Services
54 | ```
55 |
56 | ### Add CSS Reference
57 |
58 | Blazored Modal uses CSS isolation. If your application is already using CSS isolation then the styles for Modal will be included automatically and you can skip this step. However, if your application isn't using isolated CSS, you will need to add a reference to the CSS bundle. You can checkout the [Microsoft Docs](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/css-isolation?view=aspnetcore-6.0#css-isolation-bundling) for additional details.
59 |
60 | ```html
61 |
62 | ```
63 |
64 | ### Add the CascadingBlazoredModal Component
65 |
66 | The `` component cascades an instance of the `IModalService` to all decendant components. This should be added to the root component of your application (usually `App.razor`) wrapping the Router as per the example below.
67 |
68 | ```html
69 |
70 |
71 | ...
72 |
73 |
74 | ```
75 |
76 | ### Displaying a modal
77 |
78 | In order to display a modal, you must define a cascading parameter on the component that will invoke the modal:
79 |
80 | ```csharp
81 | [CascadingParameter] public IModalService Modal { get; set; } = default!;
82 | ```
83 |
84 | Once you have the cascading parameter setup, you can call the `Show` method on the `IModalService` passing in the title for the modal and the type of the component you want the modal to display. For example, if you have a component called `Movies` that you want to display in a modal from the `Home` component on a button click.
85 |
86 | ```html
87 | @page "/"
88 |
89 |
Hello, world!
90 |
91 | Welcome to Blazored Modal.
92 |
93 |
94 |
95 | @code {
96 | [CascadingParameter] public IModalService Modal { get; set; }
97 | }
98 | ```
--------------------------------------------------------------------------------
/docs/docs/styling/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Styling",
3 | "position": 3,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "How to customise the style of Blazored Modal"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/styling/animation.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # Animation
6 | By default, the modal is shown with a subtle fade in out animation. However, this can be disabled so the modal shows and hides immediately.
7 |
8 | #### Configuring for all modals
9 | ```razor
10 |
11 | ```
12 |
13 |
14 | #### Configuring for a single modal
15 | ```csharp
16 | var options = new ModalOptions()
17 | {
18 | AnimationType = ModalAnimationType.None
19 | };
20 |
21 | Modal.Show("Are you sure?", options);
22 | ```
23 |
--------------------------------------------------------------------------------
/docs/docs/styling/custom-layout.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 3
3 | ---
4 |
5 | # Custom Layout
6 | Blazored Modal provides a default look, this includes an overlay that covers the viewport and the default modal styling. However, you can remove all of this using the custom layout option. When set to `true` all of the default UI is removed and you become responsible for providing an alternative one. This option allows complete control over the look and feel of the modal.
7 |
8 | An example usecase would be an application that used the bootstrap UI library and wanted the modal and overlay to match it's design. This could be achieved in the following way.
9 |
10 | Define a component to be displayed by Blazored Modal that uses Bootstraps HTML structure and CSS classes.
11 |
12 | ```razor title="BootstrapModal.razor"
13 |
14 |
15 |
16 |
17 |
18 |
19 |
Modal title
20 |
23 |
24 |
25 |
@Message
26 |
27 |
30 |
31 |
32 |
33 |
34 | @code {
35 | [CascadingParameter] BlazoredModalInstance BlazoredModal { get; set; } = default!;
36 |
37 | [Parameter] public string? Message { get; set; }
38 |
39 | private async Task Close() => await BlazoredModal.CloseAsync(ModalResult.Ok(true));
40 | private async Task Cancel() => await BlazoredModal.CancelAsync();
41 | }
42 | ```
43 |
44 | Show the `BootstrapModal` component using Blazored Modal, setting `CustomLayout` to `true`.
45 |
46 | ```csharp
47 | var options = new ModalOptions
48 | {
49 | UseCustomLayout = true
50 | };
51 |
52 | var parameters = new ModalParameters()
53 | .Add(nameof(BootstrapModal.Message), "Hello Bootstrap modal!!");
54 |
55 | Modal.Show("Bootstrap Modal", parameters, options);
56 | ```
--------------------------------------------------------------------------------
/docs/docs/styling/custom-overlay.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | ---
4 |
5 | # Custom Overlay
6 | The overlay can be customised by providing one or more custom CSS classes to augment or overwrite the default style. Note that you may need to add the `!important` keyword to some properties due the the use of scoped CSS, which can create a higher specificity for the default styles.
7 |
8 | The following example shows how to define a CSS class that overrides the default overlay background colour.
9 |
10 | ```css title="my-app.css"
11 | .custom-modal-overlay {
12 | background-color: rgba(255, 0, 0, 0.5) !important;
13 | }
14 | ```
15 |
16 | This can then be applied to your modal with either of the following options.
17 |
18 | #### Configuring for all modals
19 | ```razor
20 |
21 | ```
22 |
23 | #### Configuring for a single modal
24 |
25 | ```csharp
26 | var options = new ModalOptions()
27 | {
28 | OverlayCustomClass = "custom-modal-overlay"
29 | };
30 |
31 | Modal.Show("Are you sure?", options);
32 | ```
--------------------------------------------------------------------------------
/docs/docs/styling/modal-style.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 1
3 | ---
4 |
5 | # Modal Style
6 | If you want to change to default look of the modal you can pass in your own CSS classes which will replace the default style classes that are applied. This allows you complete control over the look of the modal.
7 |
8 | #### Configuring for all modals
9 | ```razor
10 |
11 | ```
12 |
13 |
14 | #### Configuring for a single modal
15 | ```csharp
16 | var options = new ModalOptions()
17 | {
18 | Class = "my-custom-modal-class"
19 | };
20 |
21 | Modal.Show("Are you sure?", options);
22 | ```
23 |
24 |
--------------------------------------------------------------------------------
/docs/docs/usage/_category_.json:
--------------------------------------------------------------------------------
1 | {
2 | "label": "Usage",
3 | "position": 1,
4 | "link": {
5 | "type": "generated-index",
6 | "description": "Examples of using Blazored Modal"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/docs/docs/usage/closing-programmatically.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | ---
4 |
5 | # Closing Programmatically
6 |
7 | While most modals will be dismissed by a user via buttons on the UI, sometimes you may want to dismiss a modal programmatically. An example of such a usecase is opening a modal with a loading spinner while data is being loaded from a UI or other long running process.
8 |
9 | Closing a modal programmatically is done using the `IModalReference.Close()` method. In the following example, a `Spinner` component is shown in the modal while a long running task is being awaited. Once the long running task completes, the modal is closed programmatically.
10 |
11 | ```csharp
12 | [CascadingParameter] IModalService Modal { get; set; } = default!;
13 |
14 | private async Task ShowSpinner()
15 | {
16 | var spinnerModal = Modal.Show();
17 |
18 | await MyLongRunningTask();
19 |
20 | spinnerModal.Close();
21 | }
22 | ```
--------------------------------------------------------------------------------
/docs/docs/usage/modal-reference.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 1
3 | ---
4 |
5 | # Modal Reference
6 | When you open a modal you can capture a reference to it and await the result of that modal. This is useful when you want to perform an action when a modal is closed or cancelled.
7 |
8 | ```razor
9 | @page "/movies"
10 |
11 |
Movies
12 |
13 |
14 |
15 | @code {
16 |
17 | [CascadingParameter] IModalService Modal { get; set; } = default!;
18 |
19 | private async Task ShowModal()
20 | {
21 | var moviesModal = Modal.Show("My Movies");
22 | var result = await moviesModal.Result;
23 |
24 | if (result.Cancelled)
25 | {
26 | Console.WriteLine("Modal was cancelled");
27 | }
28 | else if (result.Confirmed)
29 | {
30 | Console.WriteLine("Modal was closed");
31 | }
32 | }
33 | }
34 | ```
--------------------------------------------------------------------------------
/docs/docs/usage/multiple-modals.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 5
3 | ---
4 |
5 | # Multiple Modals
6 | It's possible to show multiple modals at the same time, however, each new modal needs to be shown from the currently active modal.
7 |
8 | In the following example, `ModalOne` is displayed from the `Homepage` component.
9 |
10 | ```razor title="Homepage.razor"
11 |
12 |
13 | @code {
14 | [CascadingParameter] IModalService ModalService { get; set; } = default!;
15 |
16 | private void ShowModal() => ModalService.Show("First Modal");
17 | }
18 | ```
19 |
20 | `ModalOne` then has two buttons *Show Modal Two* and *Close*. Clicking *Show Modal Two* will then create a second modal, `ModalTwo`, which renders on top of `ModalOne`.
21 |
22 | ```razor title="ModalOne.razor"
23 |
46 |
47 |
48 |
49 | @code {
50 | [CascadingParameter] BlazoredModalInstance ModalTwo { get; set; } = default!;
51 |
52 | private async Task Close() => await ModalTwo.CloseAsync();
53 | }
54 | ```
55 |
--------------------------------------------------------------------------------
/docs/docs/usage/passing-data.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # Passing Data
6 | Data can be passed to a modal by using the `ModalParameters` object. The items you add to this collection must match the parameters defined on the component being displayed in the modal. Let's look at an example.
7 |
8 | The following component is going to be displayed using Blazored Modal. It defines a `Message` parameter, which is then displayed in a `p`.
9 |
10 | ```razor title="DisplayMessage.razor"
11 |
12 |
@Message
13 |
14 |
15 |
16 |
17 | @code {
18 | [CascadingParameter] BlazoredModalInstance BlazoredModal { get; set; } = default!;
19 |
20 | [Parameter] public string? Message { get; set; }
21 |
22 | private async Task Close() => await BlazoredModal.CloseAsync();
23 | }
24 | ```
25 |
26 | In order to pass a value to the `Message` parameter of the `DisplayMessage` component, we do the following.
27 |
28 | ```csharp
29 | var parameters = new ModalParameters()
30 | .Add(nameof(DisplayMessage.Message), "Hello, World!");
31 |
32 | Modal.Show("Passing Data", parameters);
33 | ```
34 |
35 | Note the use of `nameof`. Although you can define the parameter name as a string, using `nameof` gives strong typing.
--------------------------------------------------------------------------------
/docs/docs/usage/returning-data.md:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 3
3 | ---
4 |
5 | # Returning Data
6 |
7 | Data can be returned from a modal by using the `ModalResult.Data` property. You can return simple strings as well as complex objects.
8 |
9 | In the example below, a message can be entered into the `MessageForm` component and when the form is submitted, the text entered is returned to the calling component in the modal result object.
10 |
11 | ```razor title="MessageForm.razor"
12 |
41 | It is also possible to have multiple modals (like in the Multiple Modals example) with different animations. With the below modal, the first modal will appear without an animation. The second modal will fade-in and fade-out.
42 |
8 | By default, a modal is cancelled if the user clicks anywhere outside the modal. This behavior can
9 | be disabled by setting DisableBackgroundCancel to true.
10 |
8 | Custom CSS classes can be set globally or on a per modal basis to change the look of modals by overriding the default CSS class .blazored-modal.
9 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
8 | It is possible to show multiple modals at the same time. Each new modal needs to be shown from the currently active modal.
9 | In this example an initial confirmation modal is shown, if you select Yes then a second confirmation modal is shown.
10 | When you Close the second modal both modals will be closed. If you Cancel the second modal, only the second
11 | modal will be closed.
12 |
8 | Data can be passed to a modal by using the ModalParameters object. The items you add to this collection must match the parameters
9 | defined on the component being displayed in the modal. In the example below, you can type a message and see it displayed in the modal.
10 |
8 | By default, the modal is shown in the center of the viewport. The modal can be shown
9 | in a number of different positions by setting the Position option.
10 |
8 | Data can be returned from a modal by using the ModalResult.Data property. You can return simple strings as well as complex objects.
9 | In the example below, you can add a message in the modal that will be show here when you close the modal.
10 |
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.
6 |
7 |
Header Level 2
8 |
9 |
10 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
11 |
Aliquam tincidunt mauris eu risus.
12 |
13 |
14 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.
15 |
16 |
Header Level 3
17 |
18 |
19 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
20 |
Aliquam tincidunt mauris eu risus.
21 |
22 |
23 |
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus
24 |
25 |
26 |
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
27 |
Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.
28 |
Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.
29 |
Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.
41 | It is also possible to have multiple modals (like in the Multiple Modals example) with different animations. With the below modal, the first modal will appear without an animation. The second modal will fade-in and fade-out.
42 |
8 | By default, a modal is cancelled if the user clicks anywhere outside the modal. This behavior can
9 | be disabled by setting DisableBackgroundCancel to true.
10 |
8 | It is possible to show multiple modals at the same time. Each new modal needs to be shown from the currently active modal.
9 | In this example an initial confirmation modal is shown, if you select Yes then a second confirmation modal is shown.
10 | When you Close the second modal both modals will be closed. If you Cancel the second modal, only the second
11 | modal will be closed.
12 |
22 |
23 |
24 |
25 | @code {
26 |
27 | [CascadingParameter] public IModalService Modal { get; set; } = default!;
28 |
29 | async void ShowModal()
30 | {
31 | var modal = Modal.Show("Do you want to navigate to a different page?");
32 | var result = await modal.Result;
33 |
34 | if (!result.Cancelled && (result.Data is bool accepted) && accepted)
35 | {
36 | Navigator.NavigateTo ("/");
37 | }
38 | }
39 |
40 | }
--------------------------------------------------------------------------------
/samples/InteractiveWebAssembly/Pages/PassDataToModal.razor:
--------------------------------------------------------------------------------
1 | @page "/passingdata"
2 |
3 |
Passing Data to a Modal
4 |
5 |
6 |
7 |
8 | Data can be passed to a modal by using the ModalParameters object. The items you add to this collection must match the parameters
9 | defined on the component being displayed in the modal. In the example below, you can type a message and see it displayed in the modal.
10 |
8 | By default, the modal is shown in the center of the viewport. The modal can be shown
9 | in a number of different positions by setting the Position option.
10 |
8 | Data can be returned from a modal by using the ModalResult.Data property. You can return simple strings as well as complex objects.
9 | In the example below, you can add a message in the modal that will be show here when you close the modal.
10 |
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.
6 |
7 |
Header Level 2
8 |
9 |
10 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
11 |
Aliquam tincidunt mauris eu risus.
12 |
13 |
14 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.
15 |
16 |
Header Level 3
17 |
18 |
19 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
20 |
Aliquam tincidunt mauris eu risus.
21 |
22 |
23 |
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus
24 |
25 |
26 |
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
27 |
Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.
28 |
Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.
29 |
Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.