You may be able to apply for an Indefinite Leave To Remain in the UK on the basis of the death of your partner if (bereavement) if you are in the country as a partner (husband, wife, civil partner, unmarried partner, or same sex partner) of a British or a person present and settled in the UK, and your partner has passed away; and you were still and intended living together permanently at the time of their passing away.-
It is important to note that Section BPILR in the Appendix FM provides that spouses, civil partners, unmarried partners, same sex partners whose partners (sponsors) passed away during their periods of probation to be granted ILR as long as they can show that their relationship was subsisting as at the time of their partner's demise and that they were living and/or had an intention to live together on a permanent basis in the UK.
it is also important to note that these rules are not applicable to individuals who have been admitted to the UK as a partner (husband, wife, civil partner, unmarried partner, or same sex partner) of persons with limited leave to remain in the UK. In other words visa holders are not included in this bracket.
The only categories of limited leave to remain holders that can make an ILR application on the basis of having lost their partner are individuals whose leave to remain is as a spouse of a person with a refugee leave or humanitarian protection. Also exempt are EEA nationals excercising treaty rights in the UK.
Note also, that these rules do not apply to fiance visa holders as well as proposed civil partners.