sp-dev-fx-webparts/samples/section-backgrounds/README.md

58 lines
2.1 KiB
Markdown
Raw Normal View History

2019-03-13 07:11:37 -04:00
# Supporting section backgrounds in your web parts
## Summary
2023-02-18 22:58:44 -05:00
2019-03-13 07:11:37 -04:00
These samples show how to implement support for section backgrounds in your web parts.
There are 3 web parts in this solution showing how to implement support for a background and 1 web part that shows what the fallback scenario looks like.
2022-10-24 09:42:45 -04:00
For more details on the implementation, check out the documentation at https://learn.microsoft.com/sharepoint/dev/spfx/web-parts/basics/supporting-section-backgrounds
2019-03-13 07:11:37 -04:00
2023-02-18 22:58:44 -05:00
### A basic web part
2019-03-13 07:11:37 -04:00
This basic (no framework) web part implements support for backgrounds.
![Basic Web Part](./assets/webpartexample1.png)
In the 2 column section above we defined a background color and inserted the first example web part in the left column. It picks up the background color and uses the right foreground color for text.
2023-02-18 22:58:44 -05:00
### A React based web part
2019-03-13 07:11:37 -04:00
This React based web part implements support for backgrounds, alike the basic the web part.
![React Web Part](./assets/webpartexample2.png)
2023-02-18 22:58:44 -05:00
### A web part using the Office UI Framework
2019-03-13 07:11:37 -04:00
This web part implements a Office UI button which is inheriting its colors correctly from the theme
![Office UI Component Web Part](./assets/webpartexample3.png)
## Building the code
- Clone the repository
- ```npm install```
- ```gulp build```
- ```gulp serve --nobrowser```
- Open a browser, navigate to the workbench (https://yourtenant.sharepoint.com/_layouts/workbench.aspx), add a section, change the background color and add the web parts.
## Applies to
2022-10-24 09:42:45 -04:00
* [SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [Office 365 developer tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant)
2019-03-13 07:11:37 -04:00
2023-02-18 22:58:44 -05:00
## Contributors
2019-03-13 07:11:37 -04:00
2023-02-18 22:58:44 -05:00
* Microsoft
2019-03-13 07:11:37 -04:00
## Version history
Version|Date|Comments
-------|----|--------
1.0.0|March 13, 2019|Initial release
## Disclaimer
2023-02-18 22:58:44 -05:00
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
2023-03-12 21:16:15 -04:00
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/section-backgrounds" />